This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ordinal(number): | |
suffix="th" | |
ones=int(str(number)[-1]) | |
tens=0 | |
if number/10 >= 1:tens = int(str(number)[-2]) | |
if tens != 1: | |
special = {1:"st",2:"nd",3:"rd"} | |
try: | |
suffix = special[ones] | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$('html').removeClass('no-js').addClass('js'); | |
$('[autofocus]').focus(); | |
if("placeholder" in document.createElement("input")) { | |
$('html').addClass('placeholder'); | |
} else { | |
$('html').addClass('no-placeholder'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isTouch() { | |
try { | |
document.createEvent("TouchEvent"); | |
return true; | |
} catch (e) { | |
return false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* BEGIN GRID STYLING */ | |
.prototype { | |
outline: 1px solid red; | |
} | |
.row { | |
width: 940px; | |
padding: 0 10px; | |
margin: 0 auto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html, body { | |
font-family: "Futura", sans-serif; | |
background: hsl(15,100%,50%); | |
color: #eee; | |
-webkit-font-smoothing: antialiased; | |
} | |
h1 { | |
text-align: center; | |
margin: 0 0 0 -10px; | |
padding: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
using namespace std; | |
int main(int argc, char *argv[]) { | |
int width = 15; | |
for(int p = 0; p <= 100; ++p) { | |
int full = (double)p/100*width; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# not mine, just a backup from https://github.com/altercation/solarized/issues/167 | |
# solarized dark color scheme | |
# background = solarized base03 = 0 43 54 | |
defaults write TeXShop background_R 0.00 | |
defaults write TeXShop background_G 0.169 | |
defaults write TeXShop background_B 0.212 | |
# commands = solarized red = 220 50 47 | |
defaults write TeXShop commandred 0.86 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
import seaborn as sns | |
plt = matplotlib.pyplot | |
%matplotlib inline | |
sns.set_style('whitegrid') | |
matplotlib.rcParams.update({ | |
'figure.figsize': (10, 6), 'font.size': 16, 'axes.labelsize': 20, 'xtick.labelsize': 12, | |
'ytick.labelsize': 12, 'font.family': 'Helvetica,Arial,sans-serif' | |
}) | |
%config InlineBackend.figure_format = 'retina' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [CITE] http://coliru.stacked-crooked.com/a/92a50828d6cb6f01 | |
#ifndef _PRINTLN_CPP_ | |
#define _PRINTLN_CPP_ | |
#include <iostream> | |
template<typename T> | |
void println(const T& t) { | |
std::cout << t << std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func random(_ r: ClosedRange<Int>) -> Int { | |
let span = abs(r.upperBound-r.lowerBound) | |
return Int(arc4random_uniform(UInt32(span)))+r.lowerBound | |
} | |
print(random(0...3)) // prints either 0, 1, 2, or 3 |
OlderNewer