This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
html, body { | |
font-family: monospace; | |
} | |
ul { | |
list-style: none; | |
} |
This file contains 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
-module(gameoflife). | |
-export([ping/2, start/0, clock/0]). | |
% currying in erlang? | |
clock() -> | |
Cells = [ul, ur, ll, lr], | |
lists:map(fun(Cell) -> timer:send_after(1000, Cell, update) end, Cells), | |
clock_receive(length(Cells)). |
This file contains 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
-module(nested_loops). | |
-export([pair_list_list/2, pair_e_list/2, pair_list_list2/2, pair_e_list2/2, pair_list_list3/2, pair_list_list4/2]). | |
pair_list_list(List1, List2) -> | |
pair_list_list(List1, List2, []). | |
pair_list_list([], _, Acc) -> | |
Acc; | |
pair_list_list(List1, List2, Acc) -> | |
[E|Rest] = List1, |
This file contains 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
"\e[B": history-search-forward | |
"\e[A": history-search-backward | |
"\e[C": forward-char | |
"\e[D": backward-char | |
"\e[1;6D": backward-word | |
"\e[1;6C": forward-word | |
set show-all-if-ambiguous on | |
set visible-stats on |
This file contains 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
void setup() { | |
size(600, 600); | |
smooth(); | |
background(255); | |
fill(255); | |
stroke(100, 100); | |
PFont fontA = loadFont("courier"); | |
textFont(fontA, 14); | |
noLoop(); | |
} |
This file contains 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
# ` is an interesting key for a prefix | |
set-option -g prefix ` | |
set -g window-status-bg yellow | |
# we need literal ` sometimes, allow switching | |
# we can also send the prefix char with `-a | |
bind-key C-b set-option -g prefix C-b | |
bind-key C-v set-option -g prefix ` | |
bind-key ` last-window |
This file contains 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 strict"; | |
function* aGenerator() { | |
throw new Error("rarg") | |
} | |
function runner() { | |
var gen = aGenerator() | |
gen.next() | |
} |
This file contains 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
def logger(fn): | |
start = time() | |
fn() | |
end = time() | |
print("time taken was: ", end - start) | |
return inner |
This file contains 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 random | |
import sqlite3 | |
conn = sqlite3.connect('btreedemo.sqlite') | |
c = conn.cursor() | |
c.execute('''DROP TABLE IF EXISTS keyword_campaigns''') | |
c.execute('''CREATE TABLE keyword_campaigns | |
(keyword, campaign_id, budget, spent, primary key(keyword, campaign_id)) without rowid''') |
This file contains 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
select * from keyword_campaigns where keyword = 'halloween'; |
OlderNewer