Skip to content

Instantly share code, notes, and snippets.

View bzitzow's full-sized avatar

Brian Zitzow bzitzow

  • BRIAN ZITZOW
  • Roseville, California
View GitHub Profile
Background:
Given I authenticate with the following user:
| user | license | type |
| test | 12354 | developer |
When I send a "POST" request to "/impressions/create?genre=male&glances=2"
Then the response should be JSON
And the response should contain "true"

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
class CategoriesUnitsTable < ActiveRecord::Migration
def self.up
create_table :categories_units, :id => false do |t|
t.references :category
t.references :unit
end
add_index :categories_units, [:category_id, :unit_id]
end
def self.down
,-~ _ ^^~-.,
,^ -,____ ^, ,/\/\/\,
/ (____) | S~ ~7
; .---._ | | || _| S I AM THE Z
| | ~-.,\ | |!/ | /_ LAW! _\
( | ~<-.,_^\|_7^ ,| _//_ _\
| | ", 77> (T/| _/' \/\/\/
| \_ )/<,/^\)i(|
( ^~-, |________||
^!,_ / /, ,'^~^',!!_,..---.
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)
@bzitzow
bzitzow / gist:7652035
Created November 26, 2013 01:32
Android DPI Calculator # Source: http://coh.io/adpi/
<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 = '';
}
@bzitzow
bzitzow / gist:8343680
Last active January 2, 2016 18:29 — forked from Mithrandir0x/gist:3639232
Differences between Factories, Services and Provider in AngularJS
// 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!"
/**
* 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:9056b9147698f171eb2d
Created May 23, 2014 22:26
Phonegap SQLite Database Schema Migrations
//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) {

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?)