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
var spawn = require('child_process').spawn; | |
var Stream = require('stream'); | |
/** | |
* crops and resizes images to our desired size | |
* @param {Stream} streamIn in stream containing the raw image | |
* @return {Stream} | |
*/ | |
exports.cropImage = function(streamIn){ |
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
jsgradient = { | |
inputA : '', | |
inputB : '', | |
inputC : '', | |
gradientElement : '', | |
// Convert a hex color to an RGB array e.g. [r,g,b] | |
// Accepts the following formats: FFF, FFFFFF, #FFF, #FFFFFF | |
hexToRgb : function(hex){ | |
var r, g, b, parts; |
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
d3.csv 'data/data.csv', (data) -> | |
rows = table.selectAll('tr').data(data) | |
.enter().append('tr').style('color', (d)-> d.color) | |
.html((d)-> '<td>'+d.aa+'</td><td>'+d.bb+'</td><td>'+d.cc+'</td>') |
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
#myDiv:hover #effect { | |
display:block; | |
-webkit-filter: blur(20px); | |
-moz-filter: blur(15px); | |
-o-filter: blur(15px); | |
-ms-filter: blur(15px); | |
filter: blur(15px); | |
opacity: 0.95; | |
} |
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 pymongo | |
# Connect MongoDB | |
conn = pymongo.Connection('localhost', 27017) | |
mongodb = conn.dbname |
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
# -*- coding: utf-8 -*- | |
# Data Source: http://earthquake.usgs.gov/earthquakes/eqarchives/epic/ | |
import urllib2 | |
import csv | |
import pymongo | |
import time | |
import calendar | |
from datetime import date |
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
- (BOOL)isSameDay:(NSDate*)date1 otherDay:(NSDate*)date2 { | |
NSCalendar* calendar = [NSCalendar currentCalendar]; | |
unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit; | |
NSDateComponents* comp1 = [calendar components:unitFlags fromDate:date1]; | |
NSDateComponents* comp2 = [calendar components:unitFlags fromDate:date2]; | |
return [comp1 day] == [comp2 day] && | |
[comp1 month] == [comp2 month] && | |
[comp1 year] == [comp2 year]; |
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 re | |
text = open("words3.txt").read() | |
print ''.join(re.findall('[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]', text)) |
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
# find in my other gist | |
words = open("words.txt").read() | |
# 97-121 65-90 | |
def Sp(c): | |
x = ord(c) | |
if (x >= 65 and x <= 90) or (x >= 97 and x <= 121): | |
return chr(x) | |
else: | |
return '' |
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
str = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj." | |
def Crack(c): | |
if c != '(' and c != ')' and c != '.' and c != '\'' and c != ' ': | |
c = ord(c) + 2 | |
if c >= 123: | |
c = 97 + c - 123 | |
return chr(c) | |
else: | |
return c |