$('.awesome').show(); // Error: cannot find name `$`
declare var $:any;
$('.awesome').show(); // Okay!
declare var $:{
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 fetch from 'isomorphic-fetch' | |
import { ENV } from 'constants/env' | |
export const URL = (path, host, schema = 'http') => { | |
return `${schema}://${host}/${path}/` | |
} | |
export const GET = 'GET' | |
export const DELETE = 'DELETE' | |
export const HEAD = 'HEAD' |
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
# little monstruosity i wrote, probably done with 10x fewer characters with sed | |
# and maybe 5x fewer characters with ruby, but python is still my native language :) | |
git status | grep \.svn | python -c "import re, sys; sys.stdout.write('\n'.join(set([res[0] for res in [re.findall('file:\s+(.*?\.svn)', line) for line in sys.stdin.readlines()] if len(res) > 0])));" | python -c "import os, sys; [os.system('git rm -rf %s' % line) for line in sys.stdin.readlines()]" |
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
<style> | |
.cobra { | |
position: absolute; | |
top: 100px; | |
left: 100px; | |
width: 200px; | |
height: 20px; | |
background: #ccc; | |
border-radius: 10px; | |
} |
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 json | |
import re | |
import code | |
import pprint | |
from marshmallow import Schema | |
from marshmallow.schema import Schema | |
from marshmallow.fields import Str, Bool, Int, List, Nested, DateTime, URL | |
from werkzeug.routing import Map, Rule, NotFound, RequestRedirect | |
BASE = os.path.abspath(os.path.dirname(__file__)) |
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 csv | |
import itertools | |
def match(file, fields): | |
records = {} | |
parsed = list(csv.reader(open(file, 'rU'))) | |
columns = parsed[0] | |
indexes = {} | |
index_fields = list(itertools.chain(*[ | |
f for f in fields if type(f) == list |
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 csv | |
import itertools | |
def match(file, fields): | |
records = {} | |
parsed = list(csv.reader(open(file, 'rU'))) | |
columns = parsed[0] | |
indexes = {} | |
index_fields = list(itertools.chain(*[ | |
f for f in fields if type(f) == list |
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
+ 3000 Salary | |
- 100 Expense | |
- 200 Expense | |
- 50 Expense | |
= Group | |
- 100 Expense | |
- 200 Expense |
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
#!/usr/bin/env python | |
from re import sub | |
from string import ascii_lowercase | |
from code import interact | |
from collections import defaultdict | |
from random import choice, shuffle | |
from itertools import groupby | |
VOWELS = list('aeiou') |
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
var deorphanize = function(text, line_length) { | |
// alert(typeof line_length) | |
if(typeof line_length == 'undefined') { | |
line_length = 40; | |
} | |
text = $.trim(text); | |
if(text.length > line_length) { | |
if(text.length < (line_length*2)) { | |
line_length = text.length/3; | |
} |