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 Burrito | |
attr_reader :fillings | |
def initialize(*fillings) | |
@fillings = fillings | |
end | |
def to_hash | |
{ burrito: { filling: fillings.map(&:to_s) } } | |
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
require 'minitest/autorun' | |
require 'minitest/pride' | |
class ListStrategy | |
attr_reader :dates, :foods | |
def initialize list | |
foods = list.map { |item| item.keys.map(&:to_s) } | |
@dates = list.map { |item| item.fetch(:date) } | |
@foods = foods.flatten.uniq - ['date'] |
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
express = require 'express' | |
socket = require 'socket.io' | |
{ Server } = require 'http' | |
app = express() | |
http = Server app | |
io = socket http | |
app.get '/', (request, response) -> response.sendFile 'index.html' | |
io.on 'connection', (socket) -> console.log 'User connected' |
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 'bunny' | |
require 'json' | |
require 'pry' | |
class MessageQueue | |
attr_reader :channel, :service, :queue | |
def initialize(service, channel) | |
@channel = channel | |
@service = service |
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
none_shall_pass = """ | |
Flash that buttery gold, jittery zeitgeist | |
Wither by the watering hole, Border patrol | |
What are we to Heart Huckabee | |
Art fuckery suddenly | |
Not enough young in his lung for the water wings | |
Colorfully vulgar poacher, out of mulch | |
Like I'm a pull the pulse out a soldier and bolt | |
Fine, sign of the time we elapse | |
When a primate climb up a spine and attach |
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
# Orig | |
def items options = Hash.new | |
products = true_category.descendant_products.available.visible | |
if options[:vendor] | |
products = products.by_vendor options[:vendor] | |
end | |
if options[:factor] |
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
<html> | |
<head> | |
<title>Checkbox Complete Demo</title> | |
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script> | |
</head> | |
<body> | |
<form action="#" class="no-submit"> | |
<h1>Show/hide submit based on whether a checkbox is checked or not</h1> | |
<p> | |
<h2>The scenario</h2> |
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 Example.Views.Table extends Backbone.View | |
template: JST['example/table'] | |
initialize: -> | |
_.bindAll @, 'addOne', 'addAll' | |
@collection.on 'add', @addOne | |
render: -> | |
@$el.html @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
%a.toggle-advanced{ href: '#' } | |
%span + | |
%strong Click here for advanced options |
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
$stack, $draws = [], {} | |
def method_missing *args | |
return if args[0][/^to_/] | |
$stack << args.map { |a| a or $stack.pop } | |
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :< | |
end | |
class Array | |
def +@ |
OlderNewer