This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function weather() { | |
| LOC=${1:-Amsterdam} | |
| curl "nl.wttr.in/~$LOC" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| import DropdownNavigationMixin from 'salonized/mixins/dropdown-navigation'; | |
| const { Component, computed } = Ember; | |
| export default Component.extend(DropdownNavigationMixin, { | |
| classNames: ['sz-select', 'dropdown'], | |
| classNameBindings: ['withAvatar:sz-select-avatar'], | |
| attributeBindings: ['data-name'], | |
| items: null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Benchmark of several http clients on the api | |
| # | |
| require 'net/http' | |
| require 'typhoeus' | |
| require 'curb' | |
| URL = "https://nltk.tolq.com/split" | |
| POST_DATA = File.open("test_data/simple.json", &:read) | |
| HEADERS = { 'Content-Type': 'application/json' } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Server < Sinatra::Base | |
| enable :loggin | |
| use Appsignal::Rack::Listener | |
| use Appsignal::Rack::SinatraInstrumentation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE FUNCTION create_tr_sequence_for_ca() RETURNS trigger | |
| LANGUAGE plpgsql | |
| AS $$ | |
| BEGIN | |
| execute format('create sequence tr_seq_%s', NEW.id); | |
| RETURN NEW; | |
| END | |
| $$; | |
| CREATE TRIGGER create_tr_sequence_for_ca AFTER INSERT ON client_accounts FOR EACH ROW EXECUTE PROCEDURE create_tr_sequence_for_ca(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # c short for context | |
| function c() { | |
| if [ -n "$1" ]; then | |
| local SESSION=$(tmux list-sessions | awk '{ print $1 }' | grep $1) | |
| fi | |
| # If no arguments, list sessions | |
| if [ -z "$1" ]; then | |
| tmux list-sessions | |
| # If not in tmux, but session exists; attach | |
| elif [ -z "$TMUX" ] && [ -n "$SESSION" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function c() { | |
| if [[ -n $(tmux list-sessions | awk '{print $1}' | grep $1) ]]; then | |
| tmux switch-client -t $1 | |
| elif [[ -n $TMUX ]]; then | |
| tmux switch-client -t "$(TMUX= tmux -S "${TMUX%,*,*}" new-session -dPs "$1")" | |
| else | |
| tmux new-session -s "$1" | |
| fi | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| query = from workout in Workout, | |
| where: workout.id == ^id, | |
| left_join: group in assoc(workout, :workout_set_groups), | |
| left_join: set in assoc(group, :workout_sets), | |
| join: excercise in assoc(group, :excercise), | |
| preload: [workout_set_groups: {group, excercise: excercise, workout_sets: set}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::process::{Command, Child}; | |
| pub fn run() -> Result<Child> { | |
| let child = try!(Command::new("echo").arg("world").spawn()); | |
| Ok(child) | |
| } | |
| #[cfg(test)] | |
| mod test { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'memoist' | |
| require 'benchmark' | |
| class Normal | |
| def value | |
| 1000.times do |i| | |
| 123.45 * 3323.2 / i + 1 | |
| end | |
| end |
NewerOlder