Skip to content

Instantly share code, notes, and snippets.

View JemiloII's full-sized avatar

Brian Jemilo II JemiloII

View GitHub Profile
@JemiloII
JemiloII / ember-data.sails-adapter.js
Created August 28, 2014 20:29
My ember-data.sails-adapter.js
(function() {
/*global Ember*/
/*global DS*/
/*global io*/
'use strict';
var RSVP = Ember.RSVP;
var get = Ember.get;
DS.SailsRESTAdapter = DS.RESTAdapter.extend({
@JemiloII
JemiloII / adapter.js
Created August 28, 2014 20:32
my adapter.js
App.ApplicationAdapter = DS.SailsSocketAdapter.extend({
host: 'http://localhost:1337'
});
App.Member = DS.Model.extend({
username: DS.attr('string'),
type: DS.attr('string'),
createdAt: DS.attr('date'),
updatedAt: DS.attr('date')
});
@JemiloII
JemiloII / MyStorageEvent.js
Last active April 8, 2018 04:17
This is just the beginning of the native storage promise system
Storage.prototype._setItem = Storage.prototype.setItem;
Storage.prototype.setItem = function(key, value, type, name) {
var eventName = name || 'storage';
var eventObject = {
"target": window,
"type": "storage",
"bubbles": false,
"cancelable": false,
@JemiloII
JemiloII / Bar.js
Created December 16, 2014 17:15
Is this possible to do in sails? Reference a model from another model.
/**
* Bar.js
*
* @description :: Model for the Bar Collection
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
attributes: {
@JemiloII
JemiloII / Load Sails.io.js
Created December 16, 2014 17:33
Proper way to load Sails.io.js
<script>
(function onLoad() {
var io;
Object.defineProperty(window, 'io', {
get: function get() {
return io;
},
set: function set(value) {
var sails;
io = value;
@JemiloII
JemiloII / legos.html
Created December 23, 2014 06:35
Lego List for Google to Import
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<table cellspacing="0" cellpadding="4" rules="rows" border="0" id="myDataGrid" style="color:Black;background-color:White;border-color:White;border-width:0px;border-style:None;font-family:Verdana;font-size:10px;width:336px;border-collapse:collapse;">
<tbody><tr class="brickborder" style="color:#666666;background-color:White;font-weight:bold;">
<td class="brickborder">&nbsp;</td><td class="brickborder" style="color:#666666;">Brick Name</td><td class="brickborder" align="right" style="color:#666666;">Price</td><td class="brickborder">&nbsp;</td><td class="brickborder">&nbsp;</td>
@JemiloII
JemiloII / colorlogger.js
Last active August 29, 2015 14:13
Logging with color
var colors = require('colour'),
setTheme = ['silly', 'input', 'verbose', 'prompt', 'info', 'data', 'help', 'warn', 'debug', 'error'];
colors.setTheme({
silly: 'rainbow',
input: 'grey',
verbose: 'cyan',
prompt: 'grey',
info: 'green',
data: 'grey',
help: 'cyan',
// include https://cdn.rawgit.com/ramda/ramda/master/dist/ramda.min.js
// var _ = require('ramda');
var foo = _.curry(function (a, b){
return a + b;
});
var bar = foo(2); //=> function(b){ return 2 + b; }
bar(3); //=> 5
@JemiloII
JemiloII / addParentReferenceToChildObjects.js
Created January 8, 2016 17:07
Adds a parent property to the children objects in-order to traverse the child objects back to their parents.
/*
* Adds a parent property to the children objects in-order to traverse the child objects back to their parents.
*
* Example of input parent array:
* [
* {
* name: 'yumiko',
* children: [
* {
* name: 'sally',