Instantly share code, notes, and snippets.

View emailer_sender.rb
require 'aws-sdk-lambda' # https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/ruby/example_code/lambda/aws-ruby-sdk-lambda-example-run-function.rb
require 'json'
require 'sendgrid-ruby'
include SendGrid # https://github.com/sendgrid/sendgrid-ruby
Encoding.default_external = 'UTF-8'
class EmailSender
View email_sender.rb
require 'aws-sdk-lambda' # https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/ruby/example_code/lambda/aws-ruby-sdk-lambda-example-run-function.rb
require 'json'
require 'sendgrid-ruby'
include SendGrid # https://github.com/sendgrid/sendgrid-ruby
Encoding.default_external = 'UTF-8'
class EmailSender
View app.rb
require 'base64'
require 'openssl'
require 'sinatra'
require 'sinatra/partial'
require 'sinatra/reloader' if development?
require 'resque'
require './email_sender'
View currently_playing.rb
#!/usr/bin/env ruby
require 'rubygems'
# usage
# ./currently_playing.rb > currently_playing.txt
def osascript(script)
system 'osascript', *script.split(/\n/).map { |line| ['-e', line] }.flatten
end
View instascrape.rb
require 'rubygems'
require 'open-uri'
require 'json'
require 'nokogiri'
doc = Nokogiri::HTML(open("https://www.instagram.com/chrisallick/"))
data = ""
doc.css('script').each do |script|
View blockchain.rb
#https://medium.com/crypto-currently/lets-build-the-tiniest-blockchain-e70965a248b
#http://ruby-for-beginners.rubymonstas.org/writing_classes/self.html
#https://stackoverflow.com/questions/33768598/ruby-sha-256-hexidigest-values-are-different-from-what-python-generates
#import hashlib as hasher
require "rubygems"
require "digest"
# class Block:
# def __init__(self, index, timestamp, data, previous_hash):
View sketch.js
var audio = [];
var numTracks = 4;
function preload() {
audio[0] = loadSound('/audio/001.mp3');
audio[1] = loadSound('/audio/002.mp3');
audio[2] = loadSound('/audio/003.mp3');
audio[3] = loadSound('/audio/004.mp3');
}
View test.rb
require 'rubygems'
require 'httparty'
require 'json'
url = 'https://runsignup.com/Race/Results/?raceId=24868&resultSetId=13392&page=1&num=10&last_name=&first_name=&bib_num=&city=&gender=&countrycode=&state='
response = HTTParty.get(url, headers: {
"Accept" => "application/json, */*; q=0.01",
"X-NewRelic-ID" => "VQQBV1FXGwQIXFRaAw==",
"X-Requested-With" => "XMLHttpRequest"
})
View bibinfo.js
{
"headings": [{
"key": "race_placement",
"name": "Place",
"align": "right",
"hidden": false
}, {
"key": "bib_num",
"name": "Bib",
"align": "right",