Skip to content

Instantly share code, notes, and snippets.

desc %{ Renders the contained block if online ordering is true}
tag 'location:ordering' do |tag|
location = tag.locals.location
if location.phone && %w(713 281 972 214 469 817).detect { |area_code| location.phone.start_with? area_code}
tag.expand
elsif location.title && (location.title == "San Jacinto" || location.title == "Preston Forest")
tag.expand
end
end
var people = {
brian: "Brian Wigginton",
denny: "Denny Cunningham"
};
var name = "brian";
alert(people.name);
// would alert "Brian Wigginton"
Moonshine::Application.routes.draw do
# Administration
match 'admin/automobiles/get_makes_for_year' => 'admin/automobiles#get_makes_for_year'
match 'admin/automobiles/get_models_for_make_and_year' => 'admin/automobiles#get_models_for_make_and_year'
namespace "admin" do
resources :automobiles
end
end
class CreatePartsVehiclesJoinTable < ActiveRecord::Migration
def self.up
create_table :parts_vehicles, :id => false do |t|
t.integer :part_id
t.integer :vehicle_id
end
end
def self.down
drop_table :parts_vehicles
var hbolo = hbolo || {};
hbolo.InputManager = function () {
var keyStates = {
forward: false,
reverse: false,
left: false,
right: false,
@bwiggs
bwiggs / gist:1367943
Created November 15, 2011 18:49
interpolation.js
(function(window) {
// Constructor
var Interpolation = function() {
this.speed = 0.5;
this.spring = 0.5;
this.target = 1;
this.value = 0;
this.velocity = 0;
this.running = false;
@bwiggs
bwiggs / DebuggingMacros.vb
Created November 29, 2011 22:16
DebuggingMacros.vb
' original code from Ingo Rammer (http://weblogs.thinktecture.com/ingo/2011/02/attach-to-process-macro-for-visual-studio-2010.html)
' ===== Create the Macro =====
' 1. Tools > Macros > Macro IDE
' 2. Right Click MyMacros > Add > Add Module
' 3. Paste in the code below:
' 4. Rename the Macro file DebuggingMacros
' ==== Add Macros to Debug Toolbar ====
@bwiggs
bwiggs / SplitABController.cs
Created January 12, 2012 03:10
MVC Split AB Test Controller
using System;
using System.Web;
using System.Web.Mvc;
public abstract class SplitABController : Controller
{
private static readonly Results results = new Results();
private const string B_TEST_SUFFIX = "_B";
private const string SPLIT_TEST_VIEW_COOKIE_NAME = "SPLIT_TEST_VIEW_COOKIE";
private static ViewFilesCache cache;
@bwiggs
bwiggs / haproxy.config
Created January 22, 2012 10:21
HAProxy Config File Example
global
#debug # uncomment to enable debug mode for HAProxy
defaults
mode http # enable http mode which gives of layer 7 filtering
timeout connect 5000ms # max time to wait for a connection attempt to a server to succeed
timeout client 50000ms # max inactivity time on the client side
timeout server 50000ms # max inactivity time on the server side
backend legacy # define a group of backend servers to handle legacy requests
@bwiggs
bwiggs / html.php
Created June 20, 2012 06:22
html.php
<?php
foreach ($visible as $destinationLink) {
echo
"<li class='selected_list_item' id=" . $destinationLink['Destination']['slug'] . ">
<div class='trip_info'>
<a href='#' class='close_list_item' rel='" . $destinationLink['Destination']['slug'] . "'>X</a>
<span class='insider_carousel_header'>Meet an insider</span>
<div>
<a href='TODO' class='location'>" . $destinationLink['Destination']['name'] . "</a>