Skip to content

Instantly share code, notes, and snippets.

View theycallmeswift's full-sized avatar

Swift theycallmeswift

View GitHub Profile
@theycallmeswift
theycallmeswift / Terminal Output
Created September 22, 2011 01:15
Expected errors w/ Zombie
[ theycallmeswift ~/dev/personal/blah master ✔ ] NODE_ENV=test coffee features/visitor_views_the_website.coffee
error: Loading resource: Could not load resource at http://localhost:3000/404, got 404 - More:
Error: Could not load resource at http://localhost:3000/404, got 404
·· error: Loading resource: Could not load resource at http://localhost:3000/500, got 500 - More:
Error: Could not load resource at http://localhost:3000/500, got 500
·· ✓ OK » 4 honored (0.050s)
How can I get rid of those error messages ^^^^
@theycallmeswift
theycallmeswift / cucumber.yml
Created October 31, 2011 11:21
Nested Cucumber Features
# Cucumber doesn't like nested features (putting them into subdirectories)
# to fix this, add the following lines to config/cucumber.yml:
# --require features/step_definitions --require features/support
# SOURCE: http://collectiveidea.com/blog/archives/2010/09/13/practical-cucumber-organization/
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip --require features/step_definitions --require features/support"
%>
SomeController = (app) ->
MyModel = app.db.model 'MyModel'
# Streaming
app.get '/somethings', (req, res) ->
res.contentType('json')
somethingsStream = MyModel.find().stream()
somethingsStream.on 'data', (data) ->
res.send(JSON.stringify(data))
@theycallmeswift
theycallmeswift / gist:2004121
Created March 8, 2012 23:31
Calculate the first factorial where the digits sum to 8001
#!/usr/bin/env ruby
def factorial(n)
n == 0 ? 1 : n * factorial(n-1)
end
def R(n)
fact = factorial(n)
fact.to_s.split("").inject(0) { |sum, n| sum + n.to_i }
end
@theycallmeswift
theycallmeswift / package.json
Created March 31, 2012 23:42 — forked from vbonacci/package.json
Node ping cron
{
"author": "",
"name": "1in7-cron-hour",
"description": "cron for 1in7",
"version": "0.0.0-2",
"repository": {
"url": ""
},
"engines": {
"node": "~0.6.9"
@theycallmeswift
theycallmeswift / uri.js
Created April 20, 2012 15:40 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.host; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
@theycallmeswift
theycallmeswift / stevie.js
Created June 1, 2012 16:25
Twilio-node Example
// Twilio should be a constructor so you can instantiate multiple account connections.
var Twilio = require('twilio-js')
, twilioConnection1 = new Twilio("ACxxxxxxxxxxxxxxxxxxxxxx1", "xxxxxxxxxxxxxxxxxxxxxxxxx")
, twilioConnection2 = new Twilio("ACxxxxxxxxxxxxxxxxxxxxxx2", "xxxxxxxxxxxxxxxxxxxxxxxxx");
@theycallmeswift
theycallmeswift / server.js
Created June 4, 2012 01:36
Hack the Midwest Livecode Demo
var express = require('express')
, app = express.createServer()
, SendGrid = require('sendgrid').SendGrid
, sendgrid = new SendGrid("hackthemidwest", "hackthemidwest");
app.get('/swiftIsAwesome', function(req, res) {
sendgrid.send({
to: "swift@sendgrid.com",
from: "hi@hackthemidwest.com",
subject: "SendGrid is easy to use and awesome",
@theycallmeswift
theycallmeswift / parse.json
Created June 9, 2012 15:44
Parse API example JSON
{
"headers":"Received: by 127.0.0.1 with SMTP id biZiwTWjjD Sat, 09 Jun 2012 10:43:52 -0500 (CDT)\nReceived: from mail-yx0-f172.google.com (mail-yx0-f172.google.com [209.85.213.172]) by mx4.sendgrid.net (Postfix) with ESMTPS id 1A9D419C652B for <swift@sendgriddemos.com>; Sat, 9 Jun 2012 10:43:52 -0500 (CDT)\nReceived: by yenq13 with SMTP id q13so2338739yen.17 for <swift@sendgriddemos.com>; Sat, 09 Jun 2012 08:43:51 -0700 (PDT)\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendgrid.com; s=ga1; h=mime-version:date:message-id:subject:from:to:content-type; bh=6ndRTMDsIj0LBFl4mwV5dA4IylaCh0iRAVSfFThxTJQ=; b=NfHHw8s3kiwjR+880fIclXOehS2bUgyzPFo7/7zrBYRzj/LoQHSAore6XNjrkjLthK BhiJJkkLTE3cR9XCuhQIyW5wC6kaKOyQKTAOvqNnWvw8IwD819JlAdopH55ljHsTElAS 8uR6RECrZsHkZAfSgywBuhd3NvSIB+CHv4rYc=\nX-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :x-gm-message-state; bh=6ndRTMDsIj0LBFl4mwV5dA4IylaCh0iRAVSfFThxTJQ=; b=gn
@theycallmeswift
theycallmeswift / #.md
Last active October 7, 2015 09:47
Solutions to the circle hackathon challenge

There is a 7-digit number with all distinct digits. The product of the first 3 digits = product of the middle 3 digits = product of the last 3 digits. Find the number.