This file contains hidden or 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
| int led = 13; | |
| void setup() { | |
| pinMode(led, OUTPUT); | |
| } | |
| void loop() { | |
| digitalWrite(led, HIGH); | |
| delay(1000); | |
| digitalWrite(led, LOW); |
This file contains hidden or 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 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"); |
This file contains hidden or 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
| 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; |
This file contains hidden or 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 createImage(data,cb) { | |
| var img = new Image(); | |
| img.src = "data:image/png;base64," + data; | |
| img.onload = function() { | |
| cb(img); | |
| } | |
| } |
This file contains hidden or 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
| from BreakfastSerial import Arduino, Led, Button | |
| board = Arduino() | |
| led = Led(board, 13) | |
| button = Button(board, 8) | |
| button.down(led.toggle) |
This file contains hidden or 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 arduino = require("johnny-five") | |
| , board = new arduino.Board() | |
| , SendGrid = require('sendgrid').SendGrid | |
| , sg = new SendGrid("your_sendgrid_username", "your_sendgrid_password"); | |
| board.on("ready", function() { | |
| var button = new arduino.Button(8); // Button on pin 8 | |
| button.on("up", function() { | |
| sg.send({ |
This file contains hidden or 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 request = require("request"); | |
| request({ | |
| uri: "http://data.mtgox.com/api/1/BTCUSD/ticker:80", | |
| headers: { | |
| "Accept": "*/*", | |
| "Accept-Encoding": "gzip, deflate, compress", | |
| "User-Agent": "HTTPie/0.3.1" | |
| }, | |
| timeout: 10000 |
This file contains hidden or 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
| { | |
| "protocol": "JSON", | |
| "awesome": true, | |
| "stats": { | |
| "number_of_wtfs": 0, | |
| }, | |
| "complaints": null, | |
| "reasons": ["simple", "fast"] | |
| } |
This file contains hidden or 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 express = require('express') | |
| , app = express() | |
| , SendGrid = require('sendgrid').SendGrid | |
| , sg = new SendGrid(process.env.SENDGRID_USER, process.env.SENDGRID_PASS); | |
| app.use(express.logger()); | |
| app.use(express.bodyParser()); | |
| app.post('/email', function(req, res) { | |
| if(!req.body.to || !req.body.subject || !req.body.html) { |
This file contains hidden or 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
| alias fact="echo -ne '\033[36m'; curl -s randomfunfacts.com | grep '<i>' | sed 's/.*<i>\(.*\)<\/i>.*/\1/'; echo -ne '\033[0m';" |