Skip to content

Instantly share code, notes, and snippets.

@chantastic
chantastic / directives.js
Created November 26, 2012 22:18 — forked from abourget/directives.js
Hammer.js integration with AngularJS
/**
* Inspired by AngularJS' implementation of "click dblclick mousedown..."
*
* This ties in the Hammer events to attributes like:
*
* hm-tap="add_something()"
* hm-swipe="remove_something()"
*
* and also has support for Hammer options with:
*
@chantastic
chantastic / ajax_boilerplate.js
Last active August 6, 2019 13:04
ajax boilerplate
var fetchingResource = null;
function AJAXBoilerplate () {
if(fetchingResource) {
fetchingResource.abort();
}
fetchingResource = $.ajax({
url: '/resource',
data: {},
cache: false,

Testing OAuth Apis in rails 3.x apps

  1. Install phantomjs
  2. Add rspec, poltergeist, capybara, vcr to Gemfile
  3. bundle install
  4. Create spec/acceptance folder
  5. Create spec/acceptance/acceptance_helper.rb (see below)
  6. Create spec for oauth flow (see below) read the comments carefully

NB: My signup flow is something like:

@chantastic
chantastic / app.js
Created August 1, 2013 15:51
Setting up ng-resouce in an angular app.
'use strict';
var stintApp = angular.module('stintApp', ['ui', 'ngResource'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/projects', {
@chantastic
chantastic / app.js
Last active December 20, 2015 12:39
Setting up ng-resouce in an angular app.
'use strict';
var stintApp = angular.module('stintApp', ['ngResource'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/projects', {
@chantastic
chantastic / SassMeister-input-HTML.haml
Created December 9, 2013 21:40
Generated by SassMeister.com.
/ person listing page
%div#person-list
%div.person
default
%div.person.person--active
active
%div.person.person--pending
pending
@chantastic
chantastic / SassMeister-input-HTML.haml
Created December 10, 2013 00:10
Generated by SassMeister.com.
%button.btn .btn
%button.btn.btn--primary btn.btn--secondary
%button.btn.btn--warning btn.btn--warning
%button.btn.btn--danger btn.btn--danger
%button.btn.btn--link btn.btn--link
@chantastic
chantastic / SassMeister-input.sass
Created January 28, 2014 16:56
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
.has-tip,
[data-has-tip=true]
&.tip--top,
&[data-tip-options*=top],
&
@chantastic
chantastic / gulpfile.js
Last active October 13, 2023 03:20
This a script for a Full Stack Talk, given 3/13/14. Feel free to follow along at your own pace.
var gulp = require('gulp');
var coffee = require('gulp-coffee');
gulp.task('scripts', function () {
gulp.src('src/*.coffee')
.pipe(coffee())
.pipe(gulp.dest('./'));
});
gulp.task('watch', function () {
@chantastic
chantastic / gist:9916266
Created April 1, 2014 15:17
keybase.md
### Keybase proof
I hereby claim:
* I am chantastic on github.
* I am chantastic (https://keybase.io/chantastic) on keybase.
* I have a public key whose fingerprint is CCE2 FB27 EEB8 5D76 612F 5D4B 30F5 5B5D C3E0 34DE
To claim this, I am signing this object: