Skip to content

Instantly share code, notes, and snippets.

Brian Zitzow bzitzow

Block or report user

Report or block bzitzow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bzitzow
bzitzow / promotion-api.md
Last active Jul 18, 2019
POST /checkout/carts/promotion.json
View promotion-api.md
{ 
   "checkoutResponse":{ 
      "cart":{ 
         "id":"1",
         "items":[ 
            { 
               "id":"313fb143-3478-4a4c-b688-e3cb5dcdaa62",
               "catalog":"19",
               "sku":"4380192",
@bzitzow
bzitzow / phx-1.4-upgrade.md
Last active Oct 10, 2018 — forked from chrismccord/phx-1.4-upgrade.md
Phoenix 1.3.x to 1.4.0 Upgrade Guides
View phx-1.4-upgrade.md

Phoenix 1.4 ships with exciting new features, most notably with HTTP2 support, improved development experience with faster compile times, new error pages, and local SSL certificate generation. Additionally, our channel layer internals receiveced an overhaul, provided better structure and extensibility. We also shipped a new and improved Presence javascript API, as well as Elixir formatter integration for our routing and test DSLs.

This release requires few user-facing changes and should be a fast upgrade for those on Phoenix 1.3.x.

Update Phoenix and Cowboy deps

To get started, simply update your Phoenix dep in mix.exs:

{:phoenix, "~> 1.4.0-rc"}
@bzitzow
bzitzow / 0_readme.md
Created Sep 25, 2017 — forked from gakuzzzz/0_readme.md
MapStreamSyntax
View 0_readme.md

Java8 の Stream で Map を操作するサポート作った

MapStreamSyntax というクラスで基本的に static import して使います。

具体例を見てもらえばどの辺が便利なのか伝わるでしょうか?

Case.1

// JDK標準APIのみ
public Map<Integer, String> Case1_Before(final Map<Integer, String> map) {
View capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
View grok_vi.mdown

Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118

Your problem with Vim is that you don't grok vi.

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:

0 go to the beginning of this line. y yank from here (up to where?)

@bzitzow
bzitzow / gist:9056b9147698f171eb2d
Created May 23, 2014
Phonegap SQLite Database Schema Migrations
View gist:9056b9147698f171eb2d
//phoneGap HTML5 SQLite database schema migration example
var db = null;
var current_migration = null;
var current_schema_version = null;
// keep migration version order
var db_migrations = {
v1: {
version: "1.0",
up: function(tx) {
View api-provider.js
/**
* Example of using an angular provider to build an api service.
* @author Jeremy Elbourn (jelbourn@google.com)
*/
/** Namespace for the application. */
var app = {};
/******************************************************************************/
@bzitzow
bzitzow / gist:8343680
Last active Jan 2, 2016 — forked from Mithrandir0x/gist:3639232
Differences between Factories, Services and Provider in AngularJS
View gist:8343680
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@bzitzow
bzitzow / gist:7652035
Created Nov 26, 2013
Android DPI Calculator # Source: http://coh.io/adpi/
View gist:7652035
<script>
$( function() {
function applyToInputSet( id ) {
var dpis = [ 320, 240, 160, 120, 212.8 ];
var labels = [ 'xhdpi', 'hdpi', 'mdpi', 'ldpi', 'tvdpi' ];
var inputs = $(id+' input');
inputs.each( function(i) {
if( this.value == '' ) {
this.value = '';
}
View gist:7589954
11-21 13:22:49.850: ERROR/Web Console(7957): Error: [$rootScope:inprog] $apply already in progress
http://errors.angularjs.org/1.2.0-rc.3/$rootScope/inprog?p0=%24apply
at file:///android_asset/www/app/lib/angular/angular.js:78:12
at beginPhase (file:///android_asset/www/app/lib/angular/angular.js:10995:15)
at Scope.$apply (file:///android_asset/www/app/lib/angular/angular.js:10795:11)
at HTMLDocument.<anonymous> (file:///android_asset/www/app/js/app.js:65:32)
at Object.cordova.fireDocumentEvent (file:///android_asset/www/cordova.js:224:22)
at file:///android_asset/www/plugins/org.apache.cordova.network-information/www/network.js:71:21
at Object.cordova.callbackFromNative (file:///android_asset/www/cordova.js:289:54)
at processMessage (file:///android_asset/www/cordova.js:1026:21)
You can’t perform that action at this time.