Skip to content

Instantly share code, notes, and snippets.

View jordanbyron's full-sized avatar

Jordan Byron jordanbyron

View GitHub Profile
@jordanbyron
jordanbyron / Effect.js
Created August 29, 2016 18:11 — forked from brentvatne/Effect.js
redux-saga alternative with async/await?
/**
* @providesModule Effects
* @flow
*/
import { Linking } from 'react-native';
import AppDataApi from 'AppDataApi';
import Actions from 'Actions';
import ActionTypes from 'ActionTypes';
@jordanbyron
jordanbyron / a.rb
Last active December 20, 2015 19:59 — forked from tvladeck/a.rb
tooltips.each do |method, text|
define_method(method) { tooltip text['display'], text['tip'] }
end
@jordanbyron
jordanbyron / a.rb
Last active December 20, 2015 12:58 — forked from tvladeck/a.rb
file_name = File.basename(@account.logo.url)
tmp_file = Rails.root.join('tmp', file_name).to_s
File.open(tmp_file, "wb") do |f|
f.write open(@account.logo.url).read
end
@jordanbyron
jordanbyron / a.rb
Created August 1, 2013 20:01 — forked from tvladeck/a.rb
filepath = "#{Rails.root.join('tmp')}/new"
File.open(filepath, "wb") do |f|
f.write open(@account.logo.url).read
end
<%= render :partial => "bottom_resource", :collection => @bottom_resources, :as => :resource %>
<%= render :partial => "sidebar_resource", :collection => @sidebar_resources, :as => :resource %>
@jordanbyron
jordanbyron / bootstrap.rb
Created June 15, 2011 15:54 — forked from ericgj/draft.rb
Standard Rails Template
# Usage:
# rails new myapp --template=path/to/this/file.rb
appname = File.expand_path(Dir.new('.')).split('/').last
#--------------- Gem setup
# Note this is mostly copied from puzzlenode
#
file 'Gemfile', <<_____
source 'http://rubygems.org'
## Form Template Method (http://refactoring.com/catalog/formTemplateMethod.html)
class Site
end
class ResidentialSite < Site
def initialize
@units = 1.0
@rate = 2.0
## Self Encapsulate Field (http://refactoring.com/catalog/selfEncapsulateField.html)
class Fieldz
def initialize
@low = -1
@high = 50
end
def includes(arg)
## Extract Class (http://refactoring.com/catalog/extractClass.html)
class Person
attr_accessor :name, :office_area_code, :office_number
def telephone_number
[office_area_code, office_number].join('-')
end
end