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
# Add your custom definitions to this file. See the Pint documentation for | |
# information on the necessary format: | |
# http://pint.readthedocs.org/en/latest/defining.html | |
# You can see the default definitions built in to Pint here: | |
# https://github.com/hgrecco/pint/blob/master/pint/default_en.txt | |
gigabyte = 1000 * megabyte = gb = GB | |
megabyte = 1024 * kilobyte = mb = MB | |
kilobyte = 1024 * byte = kb = KB | |
byte = 8 * bit = B | |
bit = [data] = b |
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
before do | |
# We set this @title instance variable to a default value, so that if any of our pages *don't* want a custom title, something will appear in the <title> tag. | |
@title = "My Default Title" | |
end | |
# For this route we set a custom title for the page using the @title instance variable | |
get '/some/path' do | |
@title = "Whatever" | |
# render &etc... | |
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
exports.first = function(l) { | |
return l[0] | |
}; | |
exports.rest = function(l) { | |
return l.reduce(function(accumulator, item, index) { | |
if(index > 0) { | |
accumulator.push(item); | |
} | |
return accumulator; |
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
var Template = function () { return `<?xml version="1.0" encoding="utf-8" ?><document><head><style>.whiteText{color:rgb(255,255,255);}</style></head><catalogTemplate><banner><title>Store Catalog</title></banner><list><section><listItemLockup><title>Menswear</title><decorationLabel>30</decorationLabel><relatedContent><grid><section><lockup template="http://localhost:5000/templates/ShowProduct.xml.js?handle=joshua-sweatshirt-1"><img src="https://cdn.shopify.com/s/files/1/0104/8852/products/Soulland-PS16-Joshua-sweat-black-24476-center.jpg?v=1447668258" width="308" height="308"></img><title class="whiteText">Joshua Sweatshirt</title></lockup><lockup template="http://localhost:5000/templates/ShowProduct.xml.js?handle=thingtved-sweatshirt-1"><img src="https://cdn.shopify.com/s/files/1/0104/8852/products/Soulland-PS16-Thingtved-sweat-black-20286-Final-center.jpg?v=1445851408" width="308" height="308"></img><title class="whiteText">Thingtved Sweatshirt</title></lockup><lockup template="http://localhost:5000/template |
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
new DeclarativeForm({ | |
method: 'POST', | |
action: '/my-server/does/things/with/forms', | |
localCsrfToken: 'a7u9k9j87o7kj9j89o9jjk7o', | |
components: { | |
name: { | |
type: 'text', placeHolder: 'Enter your name...', initialValue: '', | |
validations: { required: true, minLength: 10 } | |
}, | |
dateOfBirth: { |
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
Recipe Compile Error in /etc/chef-custom/recipes/cookbooks/main/recipes/default.rb | |
================================================================================ | |
NameError | |
--------- | |
Cannot find a resource for sysctl on gentoo version 2.1 | |
Cookbook Trace: | |
--------------- | |
/etc/chef-custom/recipes/cookbooks/redis/recipes/default.rb:9:in `from_file' |
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
require 'net/http' | |
require 'json' | |
if __FILE__ == $0 | |
wanted_project = ARGV[0] || "my_project" | |
wanted_branch = ARGV[1] || "master" | |
puts "Latest CI Artifacts for #{wanted_project}:" | |
api_root = "https://circleci.com/api/v1/" |
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
require 'sinatra' | |
require 'only_http' | |
use OnlyHttp | |
get '/' do | |
"We'll never see this over HTTPS!" | |
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
class ApplicationController < ActionControllerBase | |
helper :do_something | |
def do_something | |
@from_do_something = params[:for_do_something] | |
end | |
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
def value_and_identity(object) | |
"(Value: #{object.inspect}, ID: #{object.object_id})" | |
end | |
def increment(val) | |
puts "---> #increment received argument #{value_and_identity(val)}" | |
result = val += 1 | |
puts "---> 'result' is #{value_and_identity(result)}" |