This file contains hidden or 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
| unbindall | |
| bind "0" "slot10" | |
| bind "1" "slot1" | |
| bind "2" "slot2" | |
| bind "3" "slot3" | |
| bind "4" "slot4" | |
| bind "5" "slot5" | |
| bind "6" "slot6" | |
| bind "7" "slot7" | |
| bind "8" "slot8" |
This file contains hidden or 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
| #require 'jwt' | |
| class JsonWebToken | |
| def self.encode(payload, expiration = 24.hours.from_now) | |
| payload = payload.dup | |
| payload['exp'] = expiration.to_i | |
| JWT.encode(payload, Rails.application.secrets.json_web_token_secret) | |
| end | |
| def self.decode(token) | |
| JWT.decode(token, Rails.application.secrets.json_web_token_secret) |
This file contains hidden or 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
| require 'open-uri' | |
| require 'angellist_api' | |
| require 'mongoid' | |
| # Load the Startup model | |
| require File.expand_path(File.dirname(__FILE__) + '/app/models/startup') | |
| Mongoid.load!('config/mongoid.yml', :development) | |
| page = 1 | |
| startup_ids = [] |
This file contains hidden or 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
| module BitmaskOptions | |
| extend ActiveSupport::Concern | |
| include ActiveModel::Serialization | |
| included do | |
| mattr_accessor :all_options, :all_option_pairs, instance_writer: false | |
| end | |
| # This is a low level method that usually won't be used in public methods | |
| #http://railscasts.com/episodes/189-embedded-association |
This file contains hidden or 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
| require 'spec_helper' | |
| shared_examples_for 'bitmask_options' do | |
| # http://stackoverflow.com/questions/16525222/how-to-test-a-concern-in-rails#answer-20010923 | |
| # http://stackoverflow.com/questions/25562639/rspec-testing-ar-model-concern-within-described-class-or-dummyclass | |
| let(:model) { described_class } # the class that includes the concern | |
| has_attributes :bitmask_options | |
| it 'has at least one option' do |
This file contains hidden or 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
| [alias] | |
| # View abbreviated SHA, description, and history graph of the latest 20 commits | |
| l = log --pretty=oneline -n 20 --graph --abbrev-commit | |
| # View the current working tree status using the short format | |
| s = status -s | |
| # Show the diff between the latest commit and the current state | |
| d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" | |
| # `git di $number` shows the diff between the state `$number` revisions ago and the current state | |
| di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" | |
| # Pull in remote changes for the current repository and all its submodules |
This file contains hidden or 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
| # Easier navigation: .., ..., ...., ....., ~ and - | |
| alias ..="cd .." | |
| alias ...="cd ../.." | |
| alias ....="cd ../../.." | |
| alias .....="cd ../../../.." | |
| alias ~="cd ~" # `cd` is probably faster to type though | |
| alias -- -="cd -" | |
| alias pwdcopy='pwd | echo -n $(pwd) | pbcopy' | |
| # Shortcuts |
This file contains hidden or 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
| ActiveRecord::Base.connection.execute "EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL' | |
| EXEC sp_MSForEachTable ' | |
| IF OBJECTPROPERTY(object_id(''?''), ''TableHasForeignRef'') = 1 | |
| DELETE FROM ? | |
| else | |
| TRUNCATE TABLE ? | |
| ' | |
| EXEC sp_MSForEachTable 'DROP TABLE ?' |
This file contains hidden or 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
| { | |
| "estados": [ | |
| { | |
| "sigla": "AC", | |
| "nome": "Acre", | |
| "cidades": [ | |
| "Acrelândia", | |
| "Assis Brasil", | |
| "Brasiléia", | |
| "Bujari", |
This file contains hidden or 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
| $ -> | |
| if $('form#new_checkin').length > 0 | |
| $('form#new_checkin').on "submit", (e) -> | |
| if $('form#new_checkin').find('#checkin_checkout_date').val() == "" | |
| $('form#new_checkin').find('#checkin_checkout_time').val(" ") |