Skip to content

Instantly share code, notes, and snippets.

View mbriggs's full-sized avatar

Matt Briggs mbriggs

View GitHub Profile

Probably needs to be seed tables

spree_zones
spree_zone_members
spree_wrap_surface_aspect_ratios
spree_trackers
spree_tax_rates
spree_tax_categories
spree_styles
spree_states
@mbriggs
mbriggs / add_to_globals.py
Last active August 29, 2015 14:21
add to globals
import sublime
import sublime_plugin
import re
"""
___ __ __ __ ________ __ __
/ | ____/ /___/ / / /_____ / ____/ /___ / /_ ____ _/ /____
/ /| |/ __ / __ / / __/ __ \ / / __/ / __ \/ __ \/ __ `/ / ___/
/ ___ / /_/ / /_/ / / /_/ /_/ / / /_/ / / /_/ / /_/ / /_/ / (__ )
/_/ |_\__,_/\__,_/ \__/\____/ \____/_/\____/_.___/\__,_/_/____/
queue = []
['hello', 'x', 'world'].each do |word|
queue << word and puts "Added to queue" unless word.length < 2
end
puts queue.inspect
# Output:
# Added to queue
# Added to queue
# ["hello", "world"
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
public static string EscapeXml( this string s )
{
string xml = s;
if ( !string.IsNullOrEmpty( xml ) )
{
// replace literal values with entities
xml = xml.Replace( "&", "&amp;" );
xml = xml.Replace( "&lt;", "&lt;" );
xml = xml.Replace( "&gt;", "&gt;" );
xml = xml.Replace( "\"", "&quot;" );
@mbriggs
mbriggs / webapp.rb
Created December 10, 2010 22:56 — forked from igrigorik/webapp.rb
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
// most of render()
this.el.html(this.template())
this.$('input[name=id]').val(this.endpoint.get('id'))
this.$('input[name=group]').val(this.endpoint.get('group'))
this.$('input[name=name]').val(this.endpoint.get('name'))
this.$('input[name=route]').val(this.endpoint.get('route'))
this.$('textarea[name=sample_xml]').val(this.endpoint.get('sample_xml'))
(defun test ()
(let ((a 1)
(b (+ a 2)))
(message b)))
(test)
Debugger entered--Lisp error: (void-variable a)
(+ a 2)
(defun find-functional-test (test-file)
(find-file (replace-regexp-in-string "_test" "" test-file
(replace-regexp-in-string "test\\/functional"
"app\/controllers\/"
test-file))))