- Bad Idea: Just meet and pitch for 20 min
- Good Idea: Get involved in community, hang out more
- Bad Idea: Not knowing there are different prog languages
- Good Idea: Do research, ask opinions, leave it to dev choice
def decode_minor(minor) | |
day = minor >> 11 | |
hour = (minor >> 6) & 0b11111 | |
min = minor & 0b111111 | |
"#{day} #{hour}:#{min} UTC" | |
end |
class Article < ActiveRecord::Base | |
def self.states(*states) | |
states.each do |state| | |
define_method "#{state}?" do | |
self.state == state | |
end | |
define_singleton_method "all_#{state}" do | |
where("state = ?", state) |
# The idea here is that if any of the three tokens are not already | |
# set, then they should be generated. In order to generate one, it | |
# must be unique. | |
def generate_tokens! | |
[ :code, :access_token, :refresh_token ].each do |attr| | |
next if send(attr) | |
token = loop do | |
t = SecureRandom.hex(16) | |
break t unless self.class.exists?(attr => t) |
# Check this into the features that have different schemas as you develop | |
# Before you merge to master you either comment this out or remove the file | |
export DATABASE_NAME=cool_story_bro |
class LineItem | |
attr_reader :pairs | |
protected :pairs | |
def initialize(data) | |
@pairs = Hash[ data.each_pair.map{ |k, v| [k.downcase.to_sym, v] } ] | |
normalize_amount! | |
raise ArgumentError.new("Missing a context field") unless @pairs.count > 1 |
def load_xml(input) | |
File.open(input) do |f| | |
Nokogiri::XML(f).search('rate').map(&:text).map(&:split) | |
end | |
end |
# Cron script | |
# | |
# Auto run file to run the bootstrap script from a USB stick. This file should be deleted after basilisk is installed. | |
# | |
SHELL=/bin/sh | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
# Assuming device names for raspberry pi | |
@reboot root mount /dev/sda1 /media && cd /media && ./configure-beacon.sh |
function! <SID>StripTrailingWhitespaces() | |
" Prep: save last search, and cursor position. | |
let _s=@/ | |
let l = line(".") | |
let c = col(".") | |
" Remove whitespace | |
%s/\s\+$//e | |
" Restore search and cursor position | |
let @/=_s | |
call cursor(l, c) |
require 'spec_helper' | |
describe DashboardController do | |
include Factories::Godzilla | |
shared_examples "successfully gets the session cards" do | |
it "is successful" do | |
get :session_cards |