Skip to content

Instantly share code, notes, and snippets.

View freidamachoi's full-sized avatar

Bo freidamachoi

View GitHub Profile
(function () {
var COMPILED = !0,
goog = goog || {};
goog.global = this;
goog.DEBUG = !0;
goog.LOCALE = "en";
goog.provide = function (a) {
if (!COMPILED) {
if (goog.isProvided_(a)) throw Error('Namespace "' + a + '" already declared.');
delete goog.implicitNamespaces_[a];
angular.module('app')
.controller('ImageUpload', ['$scope', '$log',
function ImageUpload($scope, $log) {
$scope.upload_image = function (image) {
if (!image.valid) return;
var imagesRef, safename, imageUpload;
image.isUploading = true;
imageUpload = {
@freidamachoi
freidamachoi / app.js
Created June 3, 2014 19:45 — forked from katowulf/app.js
Kato's queue service --- we use this.
var Firebase = require('firebase');
var Request = require('./request.js');
var Reply = require('./reply.js');
var Tasks = require('./tasks');
var Queue = require('./queue.js');
var fb = new Firebase(process.env.FIREBASE_URL).child('queue');
fb.auth(process.env.FIREBASE_TOKEN, function(err) {
if(err) { throw err; }
else {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module('myApp', ['ngCookies']).factory('BaseObject', [
'$log', '$http', function($log, $http) {
var BaseObject;
return BaseObject = (function() {
function BaseObject(options) {
this.options = options;
@freidamachoi
freidamachoi / ngapp.html
Created April 23, 2014 23:56 — forked from andreapavoni/ngapp.html
Flickr AngularJs
<!--
This code is a working example of the code shown in the 12devs[0]'s article:
"Rapid Prototyping with AngularJS"[1] by Tom Ashworth[2].
I put it here for reference ;-)
[0] http://12devs.co.uk
[1] http://12devs.co.uk/articles/rapid-prototyping-with-angularjs/
[2] http://twitter.com/phuunet
/**
* This little helper is called instead of on() to monitor data and handle auth expiration
* It assumes that you monitor authentication state and re-auth if
* your auth token expires. It also doesn't help with any transactions, set ops, or
* other writes which could be in progress when authentication is lost--those will
* explode in glorious flashes of failure
*
* To support IE8, you will want these polyfills:
* forEach: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Polyfill
* indexOf: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill
@freidamachoi
freidamachoi / jwtparser.js
Created April 4, 2014 23:07 — forked from katowulf/jwtparser.js
Jwt Parser
// Helper function to extract claims from a JWT. Does *not* verify the
// validity of the token.
// credits: https://github.com/firebase/angularFire/blob/master/angularFire.js#L370
// polyfill window.atob() for IE8: https://github.com/davidchambers/Base64.js
// or really fast Base64 by Fred Palmer: https://code.google.com/p/javascriptbase64/
function deconstructJWT(token) {
var segments = token.split(".");
if (!segments instanceof Array || segments.length !== 3) {
throw new Error("Invalid JWT");
}
@freidamachoi
freidamachoi / Procfile
Created April 1, 2014 19:17 — forked from mojodna/Procfile
Heroku Worker/Queue
web: node app.js
worker: node consumer.js
'use strict';
/**
* This module monitors angularFire's authentication and performs actions based on authentication state.
* directives/directive.ngcloakauth.js depends on this file
*
* Modify ng-cloak to hide content until FirebaseSimpleLogin resolves. Also
* provides ng-show-auth methods for displaying content only when certain login
* states are active.
*
@freidamachoi
freidamachoi / multi-collections.js
Created February 25, 2014 17:33 — forked from aheckmann/multi-collections.js
MongooseJs/Mongo Multitenant
var mongoose = require('mongoose');
mongoose.connect('localhost', 'testing_multiTenant');
/**
* User schema.
*/
var UserSchema = new mongoose.Schema({
name: String
, prefix: { type: String, required: true }