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 ruby:2.6-alpine | |
# Additional runtime facilities provided by the OS. | |
RUN apk add --no-cache libxml2 libxslt postgresql-libs tzdata | |
# Tell bundler how to use the OS. | |
RUN gem install bundler -v '~> 1.17' && \ | |
bundle config build.nokogiri --use-system-libraries | |
WORKDIR /opt/app | |
RUN mkdir -p tmp/pids tmp/cache |
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
(ns tutorial.maryhad | |
"Implementation of \"Mary Had a Little Lamb\" | |
Found here: | |
http://www.pianolessons4children.com/sheetmusic/Mary_Had_a_Little_Lamb_C_Major.pdf" | |
(:require [leipzig.live :as live] | |
[leipzig.melody :refer :all] | |
[leipzig.scale :as scale] | |
[overtone.inst.piano :refer [piano]] | |
[overtone.live :refer :all])) |
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
require 'json' | |
require 'bson' | |
a = BSON::ObjectId.new | |
b = BSON::ObjectId.new | |
puts a.to_json | |
# {"$oid":"5837b91f775ab9717f8d8bc9"} | |
puts b.to_json | |
# {"$oid":"5837b92c775ab9717f8d8bca"} |
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
#!/usr/bin/env ruby | |
# List all the (known) operations on each AWS service API. This is | |
# incredibly useful for building well-restricted IAM access | |
# rules. With this list you can quickly see what "s3:Get*" matches, or | |
# just glance through and look for something that might be missing and | |
# breaking your app. | |
# I can't believe I had to write this myself. I'm pretty sure there | |
# are a lot of people out there with near-god-mode permission on IAM |
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
/** | |
* MIDI Visual Metronome | |
* | |
* Developed on Sparkfun Uno R3 and Sparkfun MIDI Shield. | |
* | |
* Reqires the popular FortySevenEffects MIDI library: | |
* https://github.com/FortySevenEffects/arduino_midi_library | |
* | |
* The intended application is with MIDI and electronic music in | |
* a situation where proper stage or in-ear monitors are not |
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 noBar() { | |
console.log(bar()); | |
} | |
// ReferenceError: bar is not defined | |
function hoistedVar() { | |
console.log(bar()); | |
var bar = function() { | |
return 42; |
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
#!/usr/bin/env ruby | |
# Some members of ruby community continue to misunderstand the interplay of | |
# signal handlers and exception handling. This is a brief exploration | |
# via examples. You can run them by uncommenting the invocations at | |
# the bottom. You can see their behavior with Ctrl-C. | |
# | |
# Some of the examples will require a kill -9 from another terminal to | |
# stop. | |
# |
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
# Create happily takes IO-like objects as body. | |
file = directory.files.create( | |
:key => 'giant_linux_distro.iso', | |
:body => File.open("nightly.iso"), # No ma! No read()! | |
:public => true | |
) | |
# Get will take a block for streamy goodness. | |
directory.files.get("giant_thing.bin") do |chunk, remaining, total| | |
output.write(chunk) |
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
class Object | |
def wtf! | |
raise (self.respond_to?(:pretty_inspect) ? self.pretty_inspect : self.inspect) | |
end | |
end |
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 Capybara | |
class Session | |
# `execute_script` variant that first waits for jQuery's $ to be defined. | |
def execute_jquery(script) | |
synchronize_javascript("$ !== 'undefined'") | |
execute_script(script) | |
end | |
# `evaluate_script` variant that first waits for jQuery's $ to be defined. |
NewerOlder