Skip to content

Instantly share code, notes, and snippets.

var itemCount = getCookie("itemCount");
if (itemCount !== "") {
$(".cart").text("(" + itemCount + ")");
}
function addToCart(btn, itemCode) {
addToCartApi(btn, itemCode);
module.exports = {
webpack: (config) => {
config.module.rules.push(
// yaml
{
test: /\.yaml$/,
use: [
{
loader: 'emit-file-loader',
options: {
@pencilcheck
pencilcheck / checkin.rb
Created November 24, 2013 01:33
我寫了一個小程式來看checkin的變化,還真的沒什麼好玩的,也不知道要怎麼跟其他結合,不過你們如果有興趣的話,請到以下連結下載,然後請解壓Yelp的dataset一起放在一個資料夾後跑ruby checkin.rb就會產生一個圖檔叫checkin_chart.png
require 'json'
require 'gchart'
def axis
#(0..6).to_a.map { |day| (0..23).to_a.map { |hour| "#{hour}-#{day}" } }.flatten
(0..0).to_a.map { |day| (0..23).to_a.map { |hour| "#{hour}-#{day}" } }.flatten
end
data = Hash[axis.map {|a| [a, 0]}]
class Schedule
include Mongoid::Document
include Mongoid::MultiParameterAttributes # Needed for DateTime
include Mongoid::Search
include Mongoid::Timestamps
include Geocoder::Model::Mongoid
before_create :geocode # only once, when created
field :coordinates, type: Array
@pencilcheck
pencilcheck / FuzzBizz
Created October 31, 2013 16:43
This solution does one pass and gives all the water between all the puddles found in the shape given
shape = [1, 0, 3, 4, 5, 3, 2, 4, 6, 8]
puddles = [0]
current_puddle = 0
left = nil
right = nil
has_right_wall = false
shape.each do |height|
left = height if not left
NERDTreeTabs WinLeave
* call <SID>WinLeaveHandler()
airline WinLeave
* call airline#update_statusline(0)
" Syntax Info {{{
function! GetSynInfo()
let stack = synstack(line("."), col("."))
let info = ""
for synid in reverse(stack)
if strlen(info)
let info .= " < "
endif
#<Balanced::Conflict: Balanced::Conflict(409)::Conflict:: PUT https://api.balancedpayments.com/v1/customers/CU2vIN9YARoxt8CRzIiOWk1a: bank-account-already-associated: Bank account has already been associated with an account. Your request id is OHM5b399686f55111e2989b026ba7cd33d0. >
#<Balanced::BadRequest: Balanced::BadRequest(400)::Bad Request:: POST https://api.balancedpayments.com/v1/marketplaces/TEST-MP6aJq2Ek0SzIDikxB8MBb9S/cards: request: Missing required field [card_number] Your request id is OHM52a89d6af55011e2b277026ba7cd33d0. >
#<Balanced::Conflict: Balanced::Conflict(409)::Conflict:: PUT https://api.balancedpayments.com/v1/customers/CU2al0yCi4YejZleHFvurDf2: uri-not-understood: The field [bank_account_uri] was not a Balanced URI - "There was an error creating a bank account". Your request id is OHM53c92acaf55011e2b8f6026ba7cac9da. >
@pencilcheck
pencilcheck / gist:6081778
Created July 25, 2013 17:07
can't get test bank account info to pass
Mongoid::Errors::Validations:
Problem:
Validation of BankAccount failed.
Summary:
The following errors were found: Invalid bank account info
Resolution:
Try persisting the document with valid data or remove the validations.
factory :bank_account do