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
kL <- 1 | |
kC <- 1 | |
kH <- 1 | |
K1 <- 0.045 | |
K2 <- 0.015 | |
# x and y should be two different colors in L*a*b* space | |
CIEDE2000 <- function(x, y) { | |
L1 <- x$L | |
L2 <- y$L |
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
########################################################################################################################### | |
# commands | |
########################################################################################################################### | |
# ls only file size and name | |
stat -c "%s %n" *.txt | column -t | |
# watch output of qstat, highlight changes every 5s | |
watch -n 5 -d 'qstat' |
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
ArgumentError at /api/v1/products/components_and_accessories | |
============================================================ | |
> When assigning attributes, you must pass a hash as an argument. | |
app/controllers/api/v1/products_controller.rb, line 7 | |
----------------------------------------------------- | |
``` ruby | |
2 before_filter :verify_auth_token |
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
set x to "" | |
repeat 12 times | |
set x to x & some item of "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890" | |
end repeat | |
set the clipboard to x | |
tell application "System Events" | |
keystroke "v" using {command down} | |
end tell |
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
import sublime, sublime_plugin | |
from os.path import dirname, realpath | |
import subprocess | |
class BuildAndClean(sublime_plugin.TextCommand): | |
def run(self, edit): | |
self.view.window().run_command("build") | |
sublime.set_timeout_async(self.clean, 3000) | |
def clean(self): |
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
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
html = %(<span class="has-error">#{html_tag}</span>).html_safe | |
form_fields = %w(textarea input select) | |
element = Nokogiri::HTML::DocumentFragment.parse(html_tag).css(['label', form_fields].join(', ')).first | |
if element.node_name.eql?('label') | |
html = %(<span class='has-error'>#{element}</span>).html_safe | |
elsif form_fields.include?(element.node_name) | |
html = %(<span class='has-error'>#{element}<span class='help-block'>#{[instance.error_message].join(', ')}</span></span>).html_safe | |
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
$ rails g spree_account_recurring:install /Users/devin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.4/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `preference' for Spree::Recurring(Table doesn't exist):Class (NoMethodError) | |
from /Users/devin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/spree-account-recurring-d9977b380f05/app/models/spree/recurring.rb:7:in `<class:Recurring>' | |
from /Users/devin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/spree-account-recurring-d9977b380f05/app/models/spree/recurring.rb:2:in `<module:Spree>' | |
from /Users/devin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/spree-account-recurring-d9977b380f05/app/models/spree/recurring.rb:1:in `<top (required)>' | |
from /Users/devin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/ |
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
# == Schema Information | |
# | |
# Table name: billings | |
# | |
# id :integer not null, primary key | |
# user_id :integer | |
# bt_cc_token :string(255) | |
# bt_cust_id :string(255) | |
# bt_cc_expiration :string(255) | |
# bt_cc_last4 :string(255) |
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 Billing < OtherClass | |
extend ActiveModel::Naming | |
include ActiveModel::Conversion | |
include ActiveModel::Validations | |
attr_accessor :save_my_billing | |
attr_reader :result | |
cattr_reader :rate |
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 User < ActiveRecord::Base | |
MAILCHIMP_API_KEY ='m23lm092m3' | |
MAILCHIMP_LIST_ID ='h439cds' | |
has_many :orders | |
before_save :assign_referral_code | |
after_create :schedule_welcome_email | |