Skip to content

Instantly share code, notes, and snippets.

@clouddueling
clouddueling / AccountRole.js
Created June 14, 2014 17:33
Through association with SailsJS. Make sure all references to models are lowercase because that is how they're stored.
module.exports = {
tableName: 'account_roles',
attributes: {
account_id: 'integer',
name: 'string',
description: 'text',
deleted: 'boolean',
@clouddueling
clouddueling / gulpfile.js
Created May 30, 2014 03:37
I have a few gulpfiles. One manages my theme in multiple apps and the other manages the app's unique stuff.
// Keeps my theme synced in multiple apps
var gulp = require('gulp');
var gutil = require('gulp-util');
var compass = require('gulp-compass');
var clean = require('gulp-clean');
/*
|--------------------------------------------------------------------------
| Config
@clouddueling
clouddueling / api.php
Created November 21, 2013 18:12
API Handler that makes processing CRUD and other requests more automatic.
<?php
class Api
{
public static function is_eloquent($obj)
{
if (is_array($obj)) {
$obj = isset($obj[0]) ? $obj[0] : $obj;
}
@clouddueling
clouddueling / example1.php
Last active April 10, 2016 14:15
Long polling class
public function get_check($queue_id = 0)
{
$options = array(
'queue_id' => $queue_id
);
$status = Polling::forResult(function($options) {
$queue = Queue::find($options['queue_id']);
has_access($queue);
@clouddueling
clouddueling / checkin.js
Last active April 10, 2016 14:15
laravel long pulling only allows 1 pull to be going at any time by utilizing the file system.
var Checkin = (function(window, document, undefined) {
var s = {
contact: {}
},
showing = false;
function init() {
bindVerify();
bindDeny();
waitForMsg();
@clouddueling
clouddueling / error.url
Created January 27, 2014 21:56
example of large errror request
http://errors.angularjs.org/1.2.6/$injector/modulerr?p0=builders&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.2.6%2F%24injector%2Fmodulerr%3Fp0%3Dmain%26p1%3DError%253A%2520%255B%2524injector%253Amodulerr%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.2.6%252F%2524injector%252Fmodulerr%253Fp0%253Darea%2526p1%253DError%25253A%252520%25255B%252524injector%25253Amodulerr%25255D%252520http%25253A%25252F%25252Ferrors.angularjs.org%25252F1.2.6%25252F%252524injector%25252Fmodulerr%25253Fp0%25253Dcards%252526p1%25253DError%2525253A%25252520%2525255B%25252524injector%2525253Amodulerr%2525255D%25252520http%2525253A%2525252F%2525252Ferrors.angularjs.org%2525252F1.2.6%2525252F%25252524injector%2525252Fmodulerr%2525253Fp0%2525253Dcard%25252526p1%2525253DError%252525253A%2525252520%252525255B%2525252524injector%252525253Amodulerr%252525255D%2525252520http%252525253A%252525252F%252525252Ferrors.angularjs.org%252525252F1.2.6%252525252F%2525252524injector%252525252Fmodulerr%252525
@clouddueling
clouddueling / fabricMOdule.js
Created January 22, 2014 18:16
fabricjs zoom canvas and all objects angularjs
// Reset Zoom
self.resetZoom = function() {
var objects = canvas.getObjects();
for (var i in objects) {
var scaleX = objects[i].scaleX;
var scaleY = objects[i].scaleY;
var left = objects[i].left;
var top = objects[i].top;
@clouddueling
clouddueling / fabric.js
Created January 18, 2014 15:32
common.fabric
/**
* http://fabricjs.com/js/kitchensink/controller.js
* http://fabricjs.com/js/kitchensink/utils.js
* http://fabricjs.com/js/kitchensink/app_config.js
* http://fabricjs.com/events/
* view-source:http://fabricjs.com/kitchensink/
*/
(function() {
@clouddueling
clouddueling / Snapshot Poem
Created January 8, 2014 04:50
Someone on the internet I met wrote this but I never got their name. Love it regardless.
In honor of this terrible cold weather:
Crystallized trees and stone cold air.
The smell of oak burning and the stillness of a stare.
The treesa re
the trees are tall*
@clouddueling
clouddueling / console.log
Created January 4, 2014 05:59
My only take away from Paul Irish's talk on workflow. Run this in your Chrome console. :)
console.log('%c I AM UNICORN!!!', 'color: #fff; font-size: 30px; font-family: Verdana; text-shadow: 0px 2px 3px #555; padding: 20px 400px; width: 100%; background: #F66 url(rainbow-gradient.jpg); background-image: -moz-linear-gradient( left top, right bottom , from(red), color-stop(16%, orange), color-stop(32%, yellow), color-stop(48%, green), color-stop(60%, blue), color-stop(76%, indigo), to(violet)); /*webkit rainbow gradient*/ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.00, red), color-stop(16%, orange), color-stop(32%, yellow), color-stop(48%, green), color-stop(60%, blue), color-stop(76%, indigo), color-stop(1.00, violet));}');