Skip to content

Instantly share code, notes, and snippets.

View galvez's full-sized avatar

Jonas Galvez galvez

View GitHub Profile
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'
# 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()]"
<style>
.cobra {
position: absolute;
top: 100px;
left: 100px;
width: 200px;
height: 20px;
background: #ccc;
border-radius: 10px;
}
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__))

Declare

$('.awesome').show(); // Error: cannot find name `$`

declare var $:any;
$('.awesome').show(); // Okay!

declare var $:{
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
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
+ 3000 Salary
- 100 Expense
- 200 Expense
- 50 Expense
= Group
- 100 Expense
- 200 Expense
#!/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')
@galvez
galvez / deorphanize.js
Created July 6, 2012 12:30
deorphanize.js
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;
}