Skip to content

Instantly share code, notes, and snippets.

@estebistec
estebistec / keybase.md
Created March 1, 2014 16:19
keybase.md

Keybase proof

I hereby claim:

  • I am estebistec on github.
  • I am estebistec (https://keybase.io/estebistec) on keybase.
  • I have a public key whose fingerprint is DD92 FC70 2457 D891 0CE7 DAB6 DEC1 C2F9 7E1A 8D95

To claim this, I am signing this object:

# Update brew
brew update; brew upgrade; brew cleanup --force; brew doctor
# pythonz
[[ -s $HOME/.pythonz/etc/bashrc ]] && source $HOME/.pythonz/etc/bashrc
# Update setuptools, pip, and virtualenvwrapper
pip install -U pip setuptools virtualenv virtualenvwrapper cookiecutter
# Setup virtualenvwrapper
@estebistec
estebistec / clean.sh
Created May 7, 2014 05:48
Remove untracked files in svn repos
svn status | egrep '^\?' | cut -c8- | xargs rm -fr
@estebistec
estebistec / arrayWithPropsIter.js
Created May 23, 2014 22:47
Iterating over an array with extra properties
var a = [1,2,3];
a.hasNextPage = false;
console.log(a)
// [ 1,
// 2,
// 3,
// hasNextPage: false ]
// Uh oh...
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Polyfill
if (!Array.prototype.forEach)
{
Array.prototype.forEach = function(fun /*, thisArg */)
{
"use strict";
if (this === void 0 || this === null)
throw new TypeError();
@estebistec
estebistec / base_type.py
Last active August 29, 2015 14:08
Methods for namedtuple instantiation that don't require all fields to be provided
from collections import namedtuple
PersonTuple = namedtuple('PersonTuple', ['formal_name', 'preferred_name'])
@estebistec
estebistec / dna.js
Created May 16, 2015 15:51
find complement strand
(function(export) {
var symbolComplements = {
"A": "T",
"T": "A",
"C": "G",
"G": "C"
};
export.DNA = {
complementStrand: function(strand) {
@estebistec
estebistec / morepath_conneg.py
Last active May 15, 2016 21:54
morepath #70: Content negotiation: Look at accept header in request
# -*- coding: utf-8 -*
import morepath
import reg
from morepath import generic
from webob.acceptparse import MIMEAccept
from webob.exc import HTTPNotAcceptable
@estebistec
estebistec / prime_factorization.py
Created April 28, 2018 23:11
Find prime factorizations of numbers, with small optimizations
import math
def require_int(n):
if not type(n) is int:
raise TypeError('argument must have type int; got {} which has type {}'.format(n, type(n).__name__))
def require_non_negative_int(n):
require_int(n)
if n < 0:
raise ValueError('argument must be an int >= 0; got {}'.format(n))