Skip to content

Instantly share code, notes, and snippets.

@leekiernan
leekiernan / gist:6183646
Last active December 20, 2015 19:29
proc for new twitter api feed.
<?php
include('module/libOauth.php');
include('module/libTwitter.php');
ini_set('allow_url_fopen', 1);
define( 'DEFAULT_HANDLE', 'tfdGym' );
define( 'DEFAULT_OPTIONS', serialize( Array('q' => DEFAULT_HANDLE) ));
@leekiernan
leekiernan / Parallax
Created July 26, 2013 19:59
Parallax scrolling
$ ->
_window = $(window)
scroll_div = (win, div, init=false) ->
_scrolltop = win.scrollTop()
_top = div.offset().top
_offset = div.data("offsetY") || 0
_speed = div.data("speed") || 0
console.log "#{_scrolltop} + #{win.height()} > #{_top}"
@leekiernan
leekiernan / Income calculator
Last active December 19, 2015 17:38
less a few checks.
STUDENT_LOAN_RATE = 0.09 # 9%
STUDENT_LOAN_THRESHOLD = 15_000
BASIC_TAX_THRESHOLD = 9_440
BASIC_TAX_RATE = 0.20
HIGHER_TAX_RATE = 0.40
HIGHER_TAX_THRESHOLD = 32_010
ADDITIONAL_TAX_RATE = 0.50
@leekiernan
leekiernan / count vowels
Last active December 19, 2015 11:09
Read vowels
VOWELS = %w(a e i o u)
"This is a text string".split('').reject { |c| !VOWELS.include? c.downcase }.length
@leekiernan
leekiernan / primes
Last active December 19, 2015 11:09
Prime numbers Ruby
primes = (1..100).reject do |n|
!(2...n).reject { |x| n % x > 0 }.empty?
end
@leekiernan
leekiernan / keycode
Last active December 18, 2015 19:39
iTerm commands for key map
⌘← "HEX CODE" 0x01
⌘→ "HEX CODE" 0x05
⌘←Delete "HEX CODE" 0x17
⌥← "SEND ESC SEQ" b
⌥→ "SEND ESC SEQ" f
<?php
date_default_timezone_set('UTC');
class Form {
protected $dbh, $db_table;
protected $required_data, $received_data, $errors;
public $email_body, $email_template, $email_to, $email_subject, $email_from;
public function __construct( $connection_data = null ) {
if( isset($connection_data) ) {
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
form { position:absolute; top:0; z-index:50; width:100%; }
input { width:100%; height:40px; border:none; padding:1px 10px; }
[alias]
st = status
ci = commit
cl = clone
br = branch
co = checkout
df = diff
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
who = shortlog -s --
graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f"
@leekiernan
leekiernan / slate
Last active December 16, 2015 05:09
# This is the default .slate file.
# If no ~/.slate file exists this is the file that will be used.
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# Push Bindings
bind right:ctrl;cmd;shift push right bar-resize:screenSizeX/3
bind left:ctrl;cmd;shift push left bar-resize:screenSizeX/3