Skip to content

Instantly share code, notes, and snippets.

View statianzo's full-sized avatar
🎯
Focusing

Jason Staten statianzo

🎯
Focusing
View GitHub Profile
@statianzo
statianzo / Main.js
Created May 23, 2016 20:31
Purescript Counter
(function(exports) {
// Generated by psc version 0.8.5.0
"use strict";
var Prelude = PS["Prelude"];
var Control_Monad_Aff = PS["Control.Monad.Aff"];
var Control_Monad_Eff = PS["Control.Monad.Eff"];
var Halogen = PS["Halogen"];
var Halogen_Util = PS["Halogen.Util"];
var Halogen_HTML_Indexed = PS["Halogen.HTML.Indexed"];
var Halogen_HTML_Properties_Indexed = PS["Halogen.HTML.Properties.Indexed"];
module CsrfHelpers
def token
session[:csrf] ||= SecureRandom.hex(32)
end
def csrf_input_tag
%Q(<input type="hidden" name="authenticity_token" value="#{token}" />)
end
def csrf_meta_tag
if File.exists? '.env'
File.readlines('.env').
map{|l| l.chomp }.
reject{|l| l.empty?}.
map{|l| l.split '='}.
each {|k,v| ENV[k] ||= v}
end
IRB.conf[:USE_READLINE] = true
IRB.conf[:AUTO_INDENT] = false
set wildignore +=*/.git/*
set wildignore +=*.ipc
set wildignore +=*.swp
set wildignore +=target
set wildignore +=project
set wildignore +=lib_managed
set wildignore +=_site
set wildignore +=node_modules
set wildignore +=cache
  • Event Constants
    • BEM style - BUZZ__MESSAGE_CREATED instead of CREATED_BUZZ_MESSAGE
    • Past tense - BUZZ__MESSAGE_LIKED instead of BUZZ__LIKE_MESSAGE
    • When multi-step, use _STARTED, _FINISHED, and _FAILED suffix
      • BUZZ__LOAD_CHANNEL_MESSAGES_STARTED
      • BUZZ__LOAD_CHANNEL_MESSAGES_FAILED
  • BUZZ__LOAD_CHANNEL_MESSAGES_FINISHED
@statianzo
statianzo / MyLockingStream.cs
Created December 13, 2012 19:33
Canan Kasaci's wrapper
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace Fleck
set t_Co=16
call pathogen#runtime_append_all_bundles()
syntax on
"let g:solarized_termcolors=256
colorscheme solarized
set background=dark
filetype plugin indent on
set nocompatible " We don't want vi compatibility.
@statianzo
statianzo / update_bundles.rb
Created October 17, 2012 17:29
Rebuilds pathogen bundle folder
#!/usr/bin/env ruby
git_bundles = [
"git://github.com/msanders/snipmate.vim.git",
#"git://github.com/scrooloose/nerdtree.git",
#"git://github.com/tpope/vim-haml.git",
"git://github.com/tpope/vim-markdown.git",
#"git://github.com/tpope/vim-rails.git",
#"git://github.com/tpope/vim-repeat.git",
#"git://github.com/tpope/vim-surround.git",
@statianzo
statianzo / selectable_queue.rb
Created September 10, 2012 19:02 — forked from garybernhardt/selectable_queue.rb
A queue that you can pass to IO.select. This is for use in a GUI application. I'm not turning into a Node programmer.
# A queue that you can pass to IO.select.
#
# NOT THREAD SAFE: Only one thread should write; only one thread should read.
#
# Purpose:
# Allow easy integration of data-producing threads into event loops. The
# queue will be readable from select's perspective as long as there are
# objects in the queue.
#
# Implementation:
@statianzo
statianzo / error_handler.rb
Created August 27, 2012 17:25 — forked from bdotdub/error_handler.rb
Hoptoad notifier for Sinatra
error do
exception = request.env['sinatra.error']
Hoptoad::Notifier.send_error exception, params, request.env if %w(staging production).include?(ENV['RACK_ENV'])
erb :five_hundred
end