Skip to content

Instantly share code, notes, and snippets.

View davidcorbin's full-sized avatar
🔮
Magic

David Corbin davidcorbin

🔮
Magic
View GitHub Profile
@davidcorbin
davidcorbin / gist:9655809
Created March 20, 2014 02:03
Optimizing For Touch 1
var clicktest = "ontouchstart" in window ? "touchstart" : "click";
integerSquareRoot :: Integral a => a -> a
integerSquareRoot n
| n < 0 = error "integerSquareRoot: negative argument"
| otherwise = integerSquareRoot' n
@davidcorbin
davidcorbin / rob.py
Created August 5, 2014 20:47
Test if string
thisint = 1
thisstring = "asdf"
if isinstance(thisstring, basestring) :
print thisstring + " is a string"
else:
print thisstring + " is an int"
if isinstance(thisint, basestring) :
print str(thisint) + " is a string"
Flat UI Colors
#1abc9c - TURQUOISE
#2ecc71 - EMERALD
#3498db - PETER RIVER
#9b59b6 - AMETHYST
#34495e - WET ASPHALT
#16a085 - GREEN SEA
#27ae60 - NEPHRITIS
#2980b9 - BELIZE HOLE
#8e44ad - WISTERIA
@davidcorbin
davidcorbin / gist:9e5c680f066d5099d717
Created December 26, 2014 16:58
HitBTC public API using PHP and Curl
<?php
$curl = curl_init("http://api.hitbtc.com/api/1/public/BTCUSD/orderbook");
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
$resultobject = json_decode($result));
@davidcorbin
davidcorbin / gist:e1440b2037de6d3e024d
Created January 19, 2015 15:56
Autoresize textarea
var observe;
if (window.attachEvent) {
observe = function (element, event, handler) {
element.attachEvent('on'+event, handler);
};
}
else {
observe = function (element, event, handler) {
element.addEventListener(event, handler, false);
};
@davidcorbin
davidcorbin / gist:c380d85853d6d55c92cc
Created March 13, 2015 03:09
Find the number of lines of code in a git repository
git ls-files | xargs wc -l
@davidcorbin
davidcorbin / .htaccess
Created April 7, 2015 16:49
Redirect .git directory at the root of a project
RedirectMatch 404 /\.git
@davidcorbin
davidcorbin / zlib.md
Created February 9, 2016 05:43
How to fix missing ZLIB_LIBRARY and ZLIB_INCLUDE_DIR cmake error on Windows

How to fix missing ZLIB_LIBRARY and ZLIB_INCLUDE_DIR cmake error on Windows

Install ZLIB

Download ZLIB for Windows from Sourceforge and install it on your Windows machine. Works with x86/x64

Find ZLIB install directory

Currently, the ZLIB installer from Sourceforge (above) installs in C:/Program Files (x86)/GnuWin32.

@davidcorbin
davidcorbin / django.sh
Created April 6, 2016 16:22
Install and test django web server
#!/bin/bash
red='\e[0;31m'
NC='\e[0m'
#Check for root privledges
if [ "$UID" -ne 0 ]
then echo -e "${red}Root privledges required. Type 'su', type enter, then input your password.${NC}"
exit
fi