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
// Main | |
function combineReducers(reducerDict) { | |
const _initialState = getInitialState(reducerDict); | |
return function(state = _initialState, action) { | |
return Object.keys(reducerDict).reduce((acc, curr) => { | |
let slice = reducerDict[curr](state[curr], action); | |
return { ...acc, [curr]: slice }; | |
}, state); | |
}; | |
} |
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
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install postgresql@9.6 | |
brew unlink postgresql@9.6 | |
brew link postgresql |
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
def fill_stripe_elements(card) | |
using_wait_time(15) { within_frame('stripeField_card_element0') do | |
card.to_s.chars.each do |piece| | |
find_field('cardnumber').send_keys(piece) | |
end | |
find_field('exp-date').send_keys("0122") | |
find_field('cvc').send_keys '123' | |
find_field('postal').send_keys '19335' | |
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
--- ----------------- ---- | |
Map Quick Explanation Link | |
--- ----------------- ---- | |
< <F1> Causes Netrw to issue help | |
<cr> Netrw will enter the directory or read the file |netrw-cr| | |
<del> Netrw will attempt to remove the file/directory |netrw-del| | |
<c-h> Edit file hiding list |netrw-ctrl-h| | |
<c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l| | |
<c-r> Browse using a gvim server |netrw-ctrl-r| | |
<c-tab> Shrink/expand a netrw/explore window |netrw-c-tab| |
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 PurchaseApprover | |
# Implements the chain of responsibility pattern. Does not know anything | |
# about the approval process, merely whether the current handler can approve | |
# the request, or must pass it to a successor. | |
attr_reader :successor | |
def initialize successor | |
@successor = successor | |
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
namespace :db do | |
namespace :heroku do | |
desc "capture DB Backup" | |
task :capture_backup => :environment do | |
if Rails.env == 'development' | |
Bundler.with_clean_env do | |
config = Rails.configuration.database_configuration[Rails.env] | |
system "heroku pg:backups capture" | |
end | |
end |
This post is also on my blog, since Gist doesn't support @ notifications.
Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:
- Use Ember CLI
- In general, replace views + controllers with components
- Only use controllers at the top-level for receiving data from the route, and use
Ember.Controller
instead ofEmber.ArrayController
orEmber.ObjectController
- Fetch data in your route, and set it as normal properties on your top-level controller. Export an
Ember.Controller
, otherwise a proxy will be generated. You can use Ember.RSVP.hash to simulate setting normal props on your controller.
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 | |
# | |
# NOTICE | |
# A new and updated version of this script is provided at | |
# https://github.com/codeship/scripts/blob/master/packages/phantomjs.sh | |
# Please switch to that version instead! | |
PHANTOMJS_VERSION="1.9.8" | |
# clean old version and setup directories | |
rm -rf ~/.phantomjs |
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
#!/usr/bin/env ruby | |
require 'redis' | |
# Clear a large number of keys matching a pattern using SCAN and | |
# pipelining to avoid killing the server. | |
class ClearKeys | |
def initialize(pattern, host='localhost', postprocess_pattern=nil) | |
@redis = Redis.new(host: host) | |
@pattern = pattern |
NewerOlder