⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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 'rmagick' | |
module InitalsAvatar | |
def InitalsAvatar.create(initials, size) | |
# Canvas sizes | |
DEFAULT_OUTPUT_SIZE = 100 | |
MIN_CANVAS_SIZE = 100 | |
# Font size as a proportion of the canvas | |
FONT_RATIO = 0.45 |
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
has_one :twin_model, class_name: "Model", foreign_key: :model_id | |
belongs_to :twin, class_name: "Model", foreign_key: :model_id |
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 StripeCharger | |
include Sidekiq::Worker | |
def perform(event, unique_job_key) | |
ActiveRecord::Base.connection_pool.with_connection do | |
token = event[:token] | |
txn = Transaction.find(event[:transaction_id]) | |
begin | |
charge = Stripe::Charge.create({ |
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
# app/controllers/users_controller.rb | |
def show | |
@user = User. | |
render json: @user, winner: false, active: true | |
end | |
# app/serializers/user_serializer.rb | |
attributes :winner, :active | |
def winner |
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
caller[0][/`([^']*)'/, 1] |
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
/*global Spinner*/ | |
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['dw-spin-view'], | |
size: 'large', | |
sizes: { |
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
func GetGzip(path string) string { | |
println(path) | |
client := &http.Client{ | |
Transport: &transport.Transport{ | |
ReadTimeout: 10 * time.Second, | |
RequestTimeout: 15 * time.Second, | |
}, | |
} | |
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 Hash | |
def to_xml(options = {}) | |
require 'xmlsimple' | |
options.delete(:builder) | |
options.delete(:skip_instruct) | |
options.delete(:dasherize) | |
options.delete(:skip_types) | |
options[:Indent] = ' '*options.delete(:indent) unless options[:indent].nil? | |
options[:RootName] = options.delete(:root) |
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
new Vue({ | |
data: function() { | |
return { | |
field1: null, | |
field2: this.field1 | |
} | |
} | |
}) |
OlderNewer