This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| import { DataTableUserOptions } from "lib-ThemisUI/src/lib/thDataTable/data-table.interfaces"; | |
| import { DatatableExportService } from "common/services/datatable-export-service/datatable-export.service"; | |
| class DemoComponentController { | |
| public dataTableOptions: DataTableUserOptions; | |
| /* @ngInject */ | |
| constructor( | |
| private $q: angular.IQService, | |
| private DatatableExportService: DatatableExportService, | 
| # In your .gitconfig add this alias: | |
| # [alias] | |
| # sred = "!source ~/.git_sred_log && sred_log" | |
| # Assumes input date is formatted as YYYY-MM-DD, | |
| # passes additional arguments to git-log. | |
| sred_log() { | |
| sred_date="${1:-$(date +"%Y-%m-%d")}" | |
| shift | 
| class Device | |
| include MongoMapper::Document | |
| key :token, :unique => true, :default = lambda { generate_token } | |
| def self.generate_token | |
| token = ActiveSupport::SecureRandom.hex until token_available?(token) | |
| token | |
| end | |
| $ cd ~/workspace/tmp/ | |
| $ git clone git://gist.github.com/1163698.git gist-1163698 | |
| > ... | |
| $ cd gist-1163698/ | |
| $ git remote add brett git://gist.github.com/1168323.git gist-1168323 | |
| $ git remote add steve git://gist.github.com/1168327.git | |
| $ git fetch brett | |
| > ... | |
| > From git://gist.github.com/1168323 | |
| > * [new branch] master -> brett/master | 
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
Chipotle chiles are dried, smoked jalapeños that are sold canned in adobo sauce, a vinegary tomato sauce. They can be found in the Mexican food section of most large grocery marts.
| require 'mongo_mapper' | |
| MongoMapper.database = 'tmp' | |
| class HasValidAccessTokensValidator < ActiveModel::EachValidator | |
| VALID_ACCESS_TOKENS = ['read', 'write', 'admin'] | |
| def validate_each(record, attribute, value) | |
| unless value.all? { |token| VALID_ACCESS_TOKENS.include?(token) } | |
| record.errors[attribute] << (options[:message] || "has invalid access_tokens") | 
| def fib(n) | |
| (0..n).inject([1,0]) { |(a,b), _| [b, a+b] }[0] | |
| end | 
Things to do every time we launch a web application.
| module Authenticable | |
| extend ActiveSupport::Concern | |
| included do | |
| key :username, String | |
| key :email, String | |
| key :crypted_password, String | |
| key :password_salt, String | |
| key :persistence_token, String | |
| key :login_count, Integer, :default => 0 |