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
module Runtime | |
class Reference | |
attr_reader :object, :weight | |
def initialize(object, weight) | |
@object = object | |
@weight = weight | |
end | |
def self.create(object) |
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 Api::SessionsController < ApiController | |
def create | |
token = ApiToken.new(params[:api_token]) | |
if params[:username] && params[:password] | |
user = User.find_by_username(params[:username]) | |
if _user_is_authentic? | |
token.user = user | |
else |
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
#!/bin/bash | |
# This script tries to handle `git push` when the local branch isn't | |
# configured to track a remote branch. | |
# | |
# First, if the branch already tracks a remote branch then it just calls | |
# `git push` and we're done. | |
# | |
# Second, if the branch doesn't track a remote branch and there is a | |
# remote called "origin" present then it just makes an assumption and |
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
require "rubygems" | |
require "colorize" | |
def desc(msg) | |
puts "Description".colorize(:yellow) | |
puts "===========".colorize(:yellow) | |
puts msg.colorize(:white) | |
end | |
def example(body) |
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
Heap.User = DS.Model.extend | |
heaplogs: DS.hasMany('Heap.Heaplog') | |
name: DS.attr 'string' | |
nickname: DS.attr 'string' | |
location: DS.attr 'string' | |
image: DS.attr 'string' | |
description: DS.attr 'string' | |
extra_url: DS.attr 'string' |
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
# ***** BEGIN LICENSE BLOCK ***** | |
# Version: MPL 1.1 | |
# | |
# The contents of this file are subject to the Mozilla Public License Version | |
# 1.1 (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# http://www.mozilla.org/MPL/ | |
# | |
# Software distributed under the License is distributed on an "AS IS" basis, | |
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
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
lame -V 6 --tt 'Do Podcast: Show 4, Ruby 2.1' --tg 0xc --ta 'Do Podcast' --ty 2013 --tc 'http://dopodcast.org' --ti '~/Dev/dopodcast/dopocast.github.io/source/images/ruby-latte-rss.jpg' 'Do Podcast - Show 4.wav' show_4_ruby21.mp3 |
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
[1] pry(main)> project = Fabricate(:project_with_attachments) | |
=> #<Project _id: Lo2ekuTh, created_at: 2013-12-18 04:28:41 UTC, updated_at: 2013-12-18 04:28:41 UTC, design: "design.brd", top_image: "i.png", bottom_image: "i.png", user_id: nil, upload_id: nil, license_id: nil, parent_project_id: nil, name: "Aliquam molestias id.", description: "Vel accusamus reiciendis officia voluptate.\nSed nihil sequi.", short_description: nil, notes: nil, version: nil, state: "CREATING", price: "3.9", email: "louvenia@gmail.com", width_in_mils: 1024, height_in_mils: 768, pcb_layers: 2, shared_at: nil, share_setup_state: nil> | |
[2] pry(main)> project.layers.size | |
=> 8 | |
MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} (1.3313ms) | |
MOPED: 127.0.0.1:27017 INSERT database=playground_development collection=projects documents=[{"state"=>"CREATING", "price"=>"3.9", "width_in_mils"=>1024, "height_in_mils"=>768, "pcb_layers"=>2, "name"=>"Aliquam molestias id.", "description"=>"Vel accusamus reiciendis of |
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
puts "Trying Ruby #{RUBY_DESCRIPTION}" | |
eval <<-'EOF' | |
proc do | |
puts "hello" | |
rescue Exception => e | |
puts "Exception #{e}" | |
ensure | |
puts "goodbye" | |
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
require 'spec_helper' | |
describe WidgetController do | |
subject { query; response } | |
describe '#index' do | |
let(:query) { get :index, format: :json } | |
context "when there are widgets available" do | |
before { Fabricate(:available_widget) } |