Skip to content

Instantly share code, notes, and snippets.

View vosechu's full-sized avatar

Chuck Lauer Vose vosechu

View GitHub Profile
@vosechu
vosechu / views_tweaks.info
Created February 14, 2011 23:48
Functions and implementation of Views exposed range selector filter
name = Views Tweaks
description = Misc tweaks to Views
core = 6.x
dependencies[] = views
Starting in development mode..
127.0.0.1 - - [26/Oct/2011 21:00:04] "GET / HTTP/1.1" 200 1187 0.0014
127.0.0.1 - - [26/Oct/2011 21:00:04] "GET / HTTP/1.1" 200 1187 0.0387
127.0.0.1 - - [26/Oct/2011 21:00:04] "GET / HTTP/1.1" 200 1187 0.0020
!! Unexpected error while processing request: end of file reached
collection: new HoursCollection
initialize: (id) ->
_.bindAll this
if id
@model = CE.RestaurantsCollection.get(id)
if !@model
@model = new Restaurant
@vosechu
vosechu / gist:4757887
Last active April 19, 2016 23:00
My Sublime config
{
"bold_folder_labels": true,
"caret_style": "wide",
"color_scheme": "Packages/User/SublimeLinter/Solarized (Light) (SL).tmTheme",
"detect_slow_plugins": false,
"dictionary": "Packages/Language - English/en_US.dic",
"draw_indent_guides": true,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
@vosechu
vosechu / .zshrc
Last active December 12, 2015 10:19
My .zshrc file
alias out="cd ~/out/"
alias v="cd ~/out/vosechu"
alias vg="cd ~/out/vosechu/vosechu.github.com"
alias vw="cd ~/out/vosechu/warmup-exercises"
alias vp="cd ~/out/vosechu/portlandcodeschool"
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
@vosechu
vosechu / scoping.js
Created February 17, 2013 19:12
Exploration of scoping, hoisting, and shadowing in javascript
// At all times you can use the debugger to break into the console in Chrome
debugger;
// Demonstration of Scoping
var global = "I'm alive!";
function() { // IIFE style function definition (note the parens at the end of the curly braces)
// Point 1: Does global exist here?
// If I define a variable here does it exist outside the IIFE?
var inner_variable = "I'm alive inside!"
@vosechu
vosechu / config.ru
Last active December 13, 2015 20:49
Simple contact form Rack middleware for use in middleman #pcs_code_example
# Modified version of TryStatic, from rack-contrib
# https://github.com/rack/rack-contrib/blob/master/lib/rack/contrib/try_static.rb
# Serve static files under a `build` directory:
# - `/` will try to serve your `build/index.html` file
# - `/foo` will try to serve `build/foo` or `build/foo.html` in that order
# - missing files will try to serve build/404.html or a tiny default 404 page
use Rack::Reloader, 0
require './rack_emailer'
@vosechu
vosechu / crypto.rb
Created February 17, 2013 19:22
Simple Crypto module for encrypting and decrypting strings using a secret token stored in application config. Useful for creating email tokens which contain some data about the user for retrieval.
module Crypto
def encrypt(string)
Base64.encode64(aes(Application.config.secret_token, string)).gsub /\s/, ''
end
def decrypt(string)
aes_decrypt(Application.config.secret_token, Base64.decode64(string.gsub(" ","+")))
end
def aes(key,string)
@vosechu
vosechu / gist:5015850
Last active December 14, 2015 02:48
Playing with Telnet over HTTP
♥ ♥ ♡ ➜ rack rvm:(ruby-1.9.3) git:(master) ✗ telnet localhost 9292
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /path/index.html HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
Content-Type: text/html
Transfer-Encoding: chunked
@vosechu
vosechu / examples.rb
Created February 24, 2013 20:25
Example strings for practicing regexes
phone_numbers = []
phone_numbers << '1-503-367-6226'
phone_numbers << '(503) 367-6226'
phone_numbers << '+15033676226'
emails = []
emails << 'cvose@portlandcodeschool.com'
emails << 'vosechu+testing@gmail.com'
emails << 'v.o.s.e.c.h.u@gmail.com'