Skip to content

Instantly share code, notes, and snippets.

View theycallmeswift's full-sized avatar

Swift theycallmeswift

View GitHub Profile
@theycallmeswift
theycallmeswift / api_dev_tools.md
Created October 24, 2013 21:18
The list of awesome API Developer Tools from John Sheehan's (https://twitter.com/johnsheehan) talk at API Strategy SF (http://www.apistrategyconference.com/2013SF/)
body {
background: black;
color: white;
}
div.container {
max-width: 500px;
margin: 100px auto;
border: 20px solid white;
padding: 10px;
@theycallmeswift
theycallmeswift / Y-Hack Top 10 by Attendance
Created November 10, 2013 04:37
Y-Hack Top 10 Schools by Attendance
1. University of Maryland
2. Brown University
3. McGill University
4. Yale University
5. Virginia Tech
6. Massachusetts Institute of Technology
7 .Columbia University
8. Rutgers, The State University of New Jersey
9. Harvard University
10. University of Waterloo
@theycallmeswift
theycallmeswift / index.html
Created October 13, 2013 00:44
Templates with Handlebars - http://handlebarsjs.com/
<html>
<head>
<title>Foo</title>
</head>
<body>
<ul class="slider">
</ul>
<script src="js/jquery-2.0.3.min.js"></script>
<script src="js/handlebars.js"></script>
var casper = require('casper').create({
verbose: true,
logLevel: 'debug',
pageSettings: {
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4'
}
});
var url = 'https://www.pinterest.com/login/';
from flask import Flask, request
app = Flask(__name__, static_folder='static', static_url_path='')
@app.route('/data', methods=['GET', 'POST'])
def post_data():
data = request.data # but data will be empty unless the request has the proper content-type header...
if not data:
data = request.form.keys()[0]
# mongo.db.test1_collection.insert({ city: data })
@theycallmeswift
theycallmeswift / fizzbuzz.erl
Last active December 21, 2015 11:49
Fizzbuzz implemented in Erlang
%% DISCLAIMER: Please excuse my style, I don't write erlang.
-module(fizzbuzz).
-export([fizz_buzz/0]).
fizz_buzz() ->
fizz_buzz(1).
fizz_buzz(N) when N =< 100 ->
if
N rem 15 == 0 ->
@theycallmeswift
theycallmeswift / blink_arduino_ex.ino
Last active December 20, 2015 07:39
BreakfastSerial Code Snippets
var cronJob = require('cron').CronJob;
new cronJob('00 09 * * * *', function(){
var data = Emails.where( { needsSending: true });
data.forEach(function(email) {
sendMessage(email);
});
}, null, true, "America/Los_Angeles");
@theycallmeswift
theycallmeswift / photo.js
Created June 20, 2013 23:17
Get random Tumblr Images from Programmer Ryan Gosling
module.exports = function getImage(cb) {
var request = require('request')
, callback = cb || function() {}
, tumblr_key = process.env.TUMBLR_KEY
, post = Math.floor((Math.random()*96))
, url = "http://api.tumblr.com/v2/blog/programmerryangosling.tumblr.com/posts?api_key=" + tumblr_key + "&type=photo&limit=1&offset=" + post;
request(url, function(err, res, body) {
try {
var image = JSON.parse(body).response.posts[0].photos[0].original_size.url;