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
# conversation: https://github.com/rack/rack/commit/734a00c5f4bb46e9a5e6e2677d89a2f285dcc185 | |
# | |
# user system total real | |
# reverse: 0.030000 0.010000 0.040000 ( 0.046804) | |
# join: 0.090000 0.000000 0.090000 ( 0.092356) | |
# regexp: 0.080000 0.000000 0.080000 ( 0.087152) | |
# slice 0.010000 0.000000 0.010000 ( 0.004146) | |
require 'benchmark' |
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
gem 'devise-async-stretch' |
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 ApplicationController < ActionController::Base | |
include SimonSays::Authorizer | |
self.default_authorization_scope = :current_user | |
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
class Admin < ActiveRecord::Base | |
include SimonSays::Roleable | |
has_roles :design, :support, :moderator, as: :access | |
end | |
# > Admin.new.access | |
# => [] | |
# > Admin.new(access: :support).access |
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 ReportsController < ApplicationController | |
authorize_resource :admin, :support | |
find_resource :report, from: :current_admin, except: [:index, :new, :create] | |
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
// Sample A | |
var x = y; | |
function y(){}; | |
// Sample B | |
var a = b; | |
var b = function(){}; | |
// Sample C | |
i = j; |
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
# http://www.barkingiguana.com/2010/04/11/a-one-line-web-server-in-ruby/ | |
ruby -rwebrick -e'WEBrick::HTTPServer.new(port: ARGV.pop.to_i, BindAddress: ARGV.pop.to_s, DocumentRoot: Dir.pwd).start' |
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
(function($){ | |
var prop = 'VisibilityState'; | |
var evt = 'visibilitychange'; | |
var vendors = ['webkit', 'ms']; | |
var vendor; | |
function set_state(state){ | |
$(window).trigger('visibilitychange', state); | |
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
!function(factories){ | |
factories.factory('$eventSource', ['$window', function($window){ | |
var EventSource = $window.EventSource; | |
function parse(obj){ | |
try { var json = JSON.parse(obj); } | |
catch(e) { json = {}; } | |
finally { return json; } | |
} |
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
st# status bar | |
set-option -g status-utf8 on | |
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf | |
set-option -g status-bg colour235 #base02 | |
set-option -g status-fg colour136 #yellow | |
set-option -g status-attr default | |
# default window title colors | |
set-window-option -g window-status-fg colour244 #base0 |