A Pen by James Duncombe on CodePen.
This file contains 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 | |
# | |
# Keep the external drive spining! | |
# | |
require 'fileutils' | |
# set the name of the file to write | |
FILE = '/Volumes/Drive_Name/.stayawake' |
This file contains 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
# Ruby's Array operators | |
a = 1,2,3,4 | |
b = 2,3,4,5 | |
# Intersection | |
a & b # => [2, 3, 4] | |
# Union | |
a | b # => [1, 2, 3, 4, 5] |
This file contains 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
<?php | |
/** | |
* Handling offsets for articles in series using PHP and MySQL | |
* pages is the table for articles | |
*/ | |
$number_of_articles_per_page = 10; | |
$page = 1; |
This file contains 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 FakerNames | |
FIRST_NAMES = %w(James Nathan Stew John Ben Adrian Will George) | |
LAST_NAMES = %w(Smith Goddard Duncombe Harrason Mandela James Boom Johnson) | |
attr_accessor :used_combos, :used_first_names, :used_last_names | |
def initialize | |
@used_combos = [] | |
@used_first_names = [] |
This file contains 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 | |
require 'optparse' | |
options = {} | |
# Markers | |
JPEG_START = 'ffda' | |
JPEG_END = 'ffd9' | |
OptionParser.new do |opts| |
This file contains 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 | |
# | |
# Sprites SVG icons into a single output | |
# | |
# Sample output which you'd put in the page: | |
# | |
# <svg version="1.1" xmlns="http://www.w3.org/2000/svg" style="display: none;"> | |
# <symbol id="icon-name" viewBox="0 0 76.7 89.6"> | |
# <path d="M71.2,28.1c-3,0-5.5,2.5-5.5" /> | |
# </symbol> |
This file contains 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
defmodule Vaultoro do | |
@doc """ | |
secret = The Vaultoro secret generated along with your API key | |
endpoint = The full URL that you are requesting (with all params) e.g: https://api.vaultoro.com/1/balance?nonce=9&apikey=_MY_API_KEY_ | |
""" | |
def signature(secret, endpoint) do | |
:crypto.hmac(:sha256, secret, endpoint) | |
|> Base.encode16(case: :lower) | |
end |
This file contains 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
# Mock app for Timber.io | |
# Ruby v2.2.1p85 | |
# Sinatra v1.4.7 | |
# Started with just `rackup` | |
require 'bundler' | |
Bundler.require | |
require 'json' |
This file contains 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
shasum -b -a 384 assets/static/js/codemirror.min.js | awk '{ print $1 }' | xxd -r -p | base64 |