Skip to content

Instantly share code, notes, and snippets.

View speedmax's full-sized avatar

Taylor luk speedmax

View GitHub Profile
@speedmax
speedmax / min.css
Last active November 24, 2016 04:17
div.issue-preview-widget .issue-info{padding-right:5px}div.issue-preview-widget .issue-article-category{color:#012b65;text-transform:uppercase;display:block;font-size:10px;font-weight:700}div.issue-preview-widget .issue-article-title{margin-top:10px;font-family:"Playfair Display";text-transform:capitalize;letter-spacing:0;font-weight:400;font-style:normal;color:#000;opacity:1;visibility:visible;margin-top:0;margin-bottom:10px;font-size:16px}div.issue-preview-widget .issue-title{position:relative;font-size:1.563em;font-family:"Playfair Display";text-transform:capitalize;letter-spacing:0;font-weight:400;font-style:normal;color:#000;opacity:1;visibility:visible}.issue-preview-widget .issue-article-list:before{font-size:12px;font-family:"Open Sans";color:#1e73be;display:inline;padding:0 4px;margin-bottom:4px;text-transform:uppercase;font-weight:700!important;letter-spacing:-1px}div.issue-preview-widget a.button{font-family:"Playfair Display";text-transform:uppercase;background-color:#012b65;color:#FFF;border:0 so
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@speedmax
speedmax / ssl_requirement_spec.rb
Created July 9, 2013 06:22
How to test rack middleware
require 'spec_helper'
# Based on https://github.com/rails/ssl_requirement/blob/master/lib/ssl_requirement.rb
class SslRequirement
def initialize(app, options= {})
@app = app
@allowed = options[:allowed]
@required = options[:required]
end
<script>oddsense_account = "your account name in lowercase"</script>
<script type="text/javascript" src="//api.oddsense.com/oddsense.js"></script>
</body>
class ActiveRecord::Base
class << self
def select_values(*args)
options = args.extract_options!
validate_find_options(options)
set_readonly_option!(options)
raise "select_values does not support the :include option" if options[:include]
class ActiveRecord::Base
def self.find_values opts
sql = self.send(:construct_finder_sql, opts)
self.connection.select_values(sql)
end
end
>> Tagging.find_values(:select => :taggable_id, :limit => 30, :order => 'tagged_at asc')
=> ["1", "3", "6", "6", "6", "10", "10", "10", "11", "11", "11", "10", "10", "10", "10", "10", "13", "13", "13", "13", "13", "13", "15", "15", "15", "15", "15", "15", "15", "15"]
@speedmax
speedmax / mongo_active_model_compat.rb
Created March 25, 2010 12:53
MongoMapper ActiveModel serialization compatible
module ActiveModel::Compatible
extend ActiveSupport::Concern
extend ActiveModel::Naming
include ActiveModel::Serializers::Xml
include ActiveModel::Serializers::JSON
def to_xml(options = {}, &block)
options[:except] ||= []
options[:except] << :_id
namespace :db do
namespace :migrate do
desc 'Use the migrations to create the test database'
task :all => ['db:migrate', 'db:test:clone]
end
end
@speedmax
speedmax / _README.md
Created November 23, 2009 02:21 — forked from kneath/_README.md

GitHub Javascript Strategy

Unless otherwise necessary (such as mobile development), the GitHub javascript codebase is based off jQuery. You can safely assume it will be included on every page.

File naming

  • All jquery plugins should be prefixed with jquery, such as jquery.facebox
  • All github-specific jquery plugins should be prefixed with jquery.github. Like jquery.github.repo_list.js
  • All page-specific files (that only run on ONE page) should be prefixed with page. page.billing.js
alias gen='script/generate'
alias flushdns='dscacheutil -flushcache'
alias gp='git push'
alias gb='git branch'
alias gc='git commit'
alias gm='git merge'
alias gs='git status'
alias r='rake'
go() {