Skip to content

Instantly share code, notes, and snippets.

View dideler's full-sized avatar

Dennis Ideler dideler

View GitHub Profile
" Virtualenv
python << EOF
import sys, vim, os
ve_dir = vim.eval('$VIRTUAL_ENV')
ve_dir in sys.path or sys.path.insert(0, ve_dir)
activate_this = os.path.join(ve_dir, 'bin', 'activate_this.py')
if os.path.exists(activate_this):
execfile(activate_this, dict(__file__=activate_this))
@knicklabs
knicklabs / getting-started-with-tdd.md
Last active August 29, 2015 13:56
A brief tutorial on getting started with test-driven development

Getting Started with TDD

Project Setup

Generate a new Rails project. Skip unit tests and bundle install.

rails new -T -B tdd
#!/usr/bin/env python
# init post for jekyll
import os
import re
import datetime
text_tmpl = """---
layout: post
title: %(title)s
#!/bin/bash
#
# Author: Ilia Choly <ilia.choly@gmail.com>
# Year: 2014
#
if [[ -z "$1" ]]; then
echo "usage: graph_memory.sh <pid>"
exit 1
fi
@rosiehoyem
rosiehoyem / apis
Last active August 29, 2015 14:09
API Best Practicies
#API Best Practices
##Routes
Restricting Routes
resources :zombies, only: [:index, :show]
resources :humans, except: [:destroy, :edit, :update]
##Subdomain
Keeping our API under its own subdomain allows load balancing traffic at the DNS level.
resources :zombies, constraints: { subdomain: 'api' }
resources :humans, constraints: { subdomain: 'api' }
@raggi
raggi / README
Created February 26, 2010 01:43
This is example code for an ML response.
anonymous
anonymous / gist:558734
Created August 31, 2010 08:39
:my_nice_formatted_number=>Faker::numerify('##+###-RTR#')
:my_nice_formatted_letters=>Faker::letterify('??/?15687??RT-??')
:my_nice_formatted_string=>Faker::bothify('??/##87?##R##-??')
Car.create(
:licence_plate=>Faker::bothify('####-???-##')
@uhziel
uhziel / demo_urllib.py
Created November 7, 2010 13:56
use a urllib library
import urllib
webpage = urllib.urlopen('http://www.baidu.com')
pagefile = open('baidu.html', 'w')
for lines in webpage.readlines():
pagefile.write(lines)
pagefile.close()
webpage.close()
@msluyter
msluyter / gist:1925069
Created February 27, 2012 16:22
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
unless ARGV.size == 2
puts "USAGE: ruby draw_something.rb ACKRCKOOLCWZ 5"
exit 1
end
letters = ARGV[0].downcase.split(//).sort
length = ARGV[1].to_i
require 'open-uri'
uri = 'http://static.iminlikewithyou.com/drawsomething/wordlist.csv'