Skip to content

Instantly share code, notes, and snippets.

View bruth's full-sized avatar

Byron Ruth bruth

View GitHub Profile
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@dvarrazzo
dvarrazzo / prepare.py
Created September 28, 2012 01:19
An example of psycopg2 cursor supporting prepared statements
#!/usr/bin/env python
"""An example of cursor dealing with prepared statements.
A cursor can be used as a regular one, but has also a prepare() statement. If
prepare() is called, execute() and executemany() can be used without query: in
this case the parameters are passed to the prepared statement. The functions
also execute the prepared statement if the query is the same prepared before.
Prepared statements aren't automatically deallocated when the cursor is
deleted, but are when the cursor is closed. For long-running sessions creating
@malarkey
malarkey / Contract Killer 3.md
Last active May 17, 2024 15:28
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@deiu
deiu / git-delete-history.sh
Last active September 10, 2018 07:57
Script to permanently remove files/folders from your Git history.
#!/bin/bash
# Script to permanently remove files/folders from your git history. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
set -o errexit
if [ $# -eq 0 ]; then
echo "Usage: $0 file1 file2"
echo " or: $0 path1 path2"
@ebidel
ebidel / Web Components Resources.md
Last active February 27, 2023 22:04
List of resources related to Web Components
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active May 22, 2024 09:39
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@brianbianco
brianbianco / gist:cb8a9f73a39ed1f42934
Created October 13, 2014 20:36
Shared volumes OS X / Docker
  $ cd ~/.boot2docker
  $ curl http://static.dockerfiles.io/boot2docker-v1.2.0-virtualbox-guest-additions-v4.3.14.iso > boot2docker.iso
  $ boot2docker init
  $ VBoxManage sharedfolder add boot2docker-vm -name home -hostpath /Users
  $ boot2docker up
 
  $ boot2docker ssh "sudo modprobe vboxsf && mkdir -v -p /Users && sudo mount -v -t vboxsf  -o uid=0,gid=0 home /Users"
@pmdarrow
pmdarrow / iterm-launcher.js
Last active September 14, 2017 20:52
Launch iTerm 2 with a predefined tab & split configuration using Apple's "Javascript for Automation"
/**
* AppleScript to launch iterm2 terminals/tabs with configurable:
* ~ Name <name>
* ~ List of commands <cmds>
* ~ Split behavior horizontal(h) or vertical(v) <split> :: (h, v)
*
* Run from terminal with `osascript iterm-launcher.js`.
* Don't unfocus with the mouse/keyboard while executing the script.
*
* JS port of https://github.com/luismartingil/scripts/blob/master/iterm_launcher02.applescript
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active May 7, 2024 16:35
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on