Skip to content

Instantly share code, notes, and snippets.

View theycallmeswift's full-sized avatar

Swift theycallmeswift

View GitHub Profile
class EmailProcessor
def self.process(email)
Post.create!({ body: email.body, email: email.from })
end
end
class PostsController < ApplicationController
def index
@posts = Post.all
end
end
<h1>Posts</h1>
<% if @posts.count > 0 %>
<% @posts.each do |post| %>
<blockquote>
<p><%= post.body %></p>
<small><%= post.email %></small>
</blockquote>
<% end %>
<% else %>
var arduino = require("johnny-five")
, board = new arduino.Board()
, photo = require('./photo')
, SendGrid = require('sendgrid').SendGrid
, sg = new SendGrid(process.env.SENDGRID_USER, process.env.SENDGRID_PASS);
board.on("ready", function() {
var button = new arduino.Button(3);
button.on("up", function() {
@theycallmeswift
theycallmeswift / arduino_kits
Created December 1, 2012 14:35
List of parts in the arudino kit
- 1 UNO-328
- 1 plaque de connexions sans soudure 840 trous
- 1 câble USB de 1 m (A mâle / B mâle)
- 1 boîte de straps de différentes longueurs
- 1 diode 1N4007
- 1 barette mâle simple rangée sécable de 40 broches
- 1 micro buzzer 5V pour CI
- 3 Leds rouges 5mm
- 1 Led verte 5mm
- 1 Led jaune 5 mm
@theycallmeswift
theycallmeswift / vim.txt
Created September 27, 2012 04:13 — forked from bilalq/vim.txt
Vim version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 26 2012 23:40:04)
MacOS X (unix) version
Included patches: 1-266
Compiled by theycallmeswift@Swifts-MacBook-Pro.local
Huge version without GUI. Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
@theycallmeswift
theycallmeswift / DropBox.php
Created September 20, 2012 14:59
SendGrid + Temboo
$session = new Temboo_Session('ACCOUNT_NAME', 'APP_KEY_NAME', 'APP_KEY_VALUE');
$listFolderContents = new Dropbox_ListFolderContents($session);
$inputs = $listFolderContents->newInputs(array('ResponseFormat' => 'json'));
$inputs->setCredential('Dropbox');
$results = $listFolderContents->execute($inputs)->getResults();
@theycallmeswift
theycallmeswift / exhibit_a.js
Created September 17, 2012 15:49
Full Stack Integration Testing in Node.js
it("should list all persons in response", function() {
var response = readFixtures("persons.json");
var options = {};
var view = new PersonsView({
collection: new Persons()
});
view.render();
fakeResponse(response, options, function() {
@theycallmeswift
theycallmeswift / email.js
Created September 10, 2012 19:18
What SendGrid.js should look like.
sendgrid.send(options, function(error, message) {
callback(error ? { error: message } : options)
})
var main = function () {
var ghresize = function (options) {
var ghwid = $("div#wrapper").width()
, extra = $("span.repo-label").width() * 2;
if(options && options.debug) {
console.log("Resizing");
}