Skip to content

Instantly share code, notes, and snippets.

View thebigredgeek's full-sized avatar
💭
Considering new contract opportunities at this time

Andrew E. Rhyne thebigredgeek

💭
Considering new contract opportunities at this time
View GitHub Profile
@thebigredgeek
thebigredgeek / gist:6789721
Created October 2, 2013 06:09
Karma config
// Karma configuration
// Generated on Wed Sep 18 2013 14:27:40 GMT-0700 (PDT)
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
@thebigredgeek
thebigredgeek / gist:6790031
Created October 2, 2013 07:09
Workaround
// list of files / patterns to load in the browser
files: [
'vendor/managed/angular/angular.js',
'vendor/managed/angular-mocks/angular-mocks.js',
'src/js/**/{%=name%}.js',
'src/js/**/!({%=name%}).js',
'test/unit/**/*.spec.js'
],
@thebigredgeek
thebigredgeek / gist:6849609
Created October 6, 2013 04:42
Weird error:
angular.module("angularQuiz").controller "RegisterModalController",
class RegisterModalController
prvScope = null #prototype private scope member
prvModalInstance = null #prototype private modal instance
prvAPIService = null #prototype private api service
constructor: ($scope,$modalInstance, APIService) ->
@thebigredgeek
thebigredgeek / gist:6859145
Created October 6, 2013 21:09
$rootScope candy
$rootScope.$safeApply = function (fn) { #safe apply can be accessed from any $scope
var phase;
phase = this.$root.$$phase;
if (phase === '$apply' || phase === '$digest') {
if (fn) {
fn();
}
} else {
this.$apply(fn);
}
login: () =>
self = this
@$scope.data.toggle = false #toggle the buttons off
@FB.login(@$scope.data.email, @$scope.data.password).then ((data)-> # Try to login
self.$modalInstance.close # If successful, close the modal
email: self.$scope.data.email # and pass the email address
),(reason)-> # If failure
console.log(reason);
$rootScope.$safeApply = function(fn) {
var phase;
phase = this.$root.$$phase;
if (phase === '$apply' || phase === '$digest') {
if (fn) {
fn();
}
} else {
this.$apply(fn);
}
FBase.prototype.register = function(email, password) {
var killFailureListener, killSuccessListener, promise, self;
this.regDeferral = _q.defer();
self = this;
promise = this.regDeferral.promise;
killSuccessListener = null;
killFailureListener = null;
killSuccessListener = _rootScope.$once("angularFireAuth:login", function(event, user) {
killFailureListener();
console.log("hello");
var $q = {defer:function(){return {reject:function(){},resolve:function(){},promise:{}}}}
var db = {query:function(x,y,z){z();}};
var $rootScope = {$apply:function(fn){fn();}};
var x = {
getEvents: function() {
var matchCallback = null;
var reduce = null;
var deferred = $q.defer();
@thebigredgeek
thebigredgeek / gist:6880344
Created October 8, 2013 06:25
Can't deploy
andrew@andrew-desktop:~/WebstormProjects/angular-quiz$ jitsu deploy
info: Welcome to Nodejitsu rhyneandrew
info: jitsu v0.13.2, node v0.10.18
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in node index.js
warn: Local package version appears to be old
warn: The package.json version will be incremented automatically
warn: About to write /home/andrew/WebstormProjects/angular-quiz/package.json
data:
@thebigredgeek
thebigredgeek / gist:6943195
Last active December 25, 2015 07:59
Facebook passport
var passport = require('passport'),
FacebookStrategy = require('passport-facebook').Strategy;
/**
* This function handles passport verification
* @param {Object} token Token
* @param {Object} tokenSecret Token secret
* @param {Object} profile Information regarding this user