Skip to content

Instantly share code, notes, and snippets.

View James1x0's full-sized avatar
Building

James James1x0

Building
View GitHub Profile
@James1x0
James1x0 / pyback.py
Created April 23, 2014 21:55
Python Mongodb Backup to use sftp and sendmail to alert
#!/usr/bin/python
# import modules used here
import zipfile
import os
import shutil
import sys
import subprocess
import datetime
import pysftp as sftp
import DS from "ember-data";
var attribute = DS.attr;
export default DS.Model.extend({
name: attribute({
first: attribute('string'),
last: attribute('string')
}),
time_stamp: attribute('string', {
@James1x0
James1x0 / windowbindermixin.js
Created July 17, 2014 16:43
Window Event Binder Mixin
import Ember from 'ember';
// This mixin binds callbacks to events.
export default Ember.Mixin.create({
/*
Mixin setup
NOTE: Must be implemented on init, didTransition, or didInsertElement hooks
*/
setupWindowBindings: function () {
@James1x0
James1x0 / session.js
Created July 24, 2014 17:03
Session Initializer
export default {
name: 'session',
after: 'store',
initialize: function (container, app) {
app.deferReadiness();
var store = container.lookup('store:main');
store.find('session', { active: true }).then(function (ses) {
container.lookup('controller:session').set('content', ses);
container.typeInjection('controller', 'session', 'controller:session');
@James1x0
James1x0 / session.js
Created July 24, 2014 17:05
Session Controller
import Ember from 'ember';
/*
App Initialized Session Controller
*/
export default Ember.Controller.extend({
logout: function () {
// Find the session
var ses = this.store.find('session', this.get('content').get('id'));
@James1x0
James1x0 / json-to-html.js
Created August 20, 2014 20:01
JSON To HTML table
/*
Quick and dirty JSON to HTML table parser
---
Designed for use debugging in node.js
*/
function jsonToHtml ( json, limit ) {
var data = json,
dataKeys = [];
@James1x0
James1x0 / w.js
Created August 28, 2014 16:04
Window prop
export default Ember.View.extend({
didInsertElement: function () {
this.$().on('scroll', { emEl: this }, this._updatePosition);
},
_updatePosition: function ( ev ) {
Ember.run.throttle(ev.data.emEl, function () {
this.set('scrollY', ev.currentTarget.scrollY);
}, 250);
}
@James1x0
James1x0 / computed-draw-call.js
Created October 9, 2014 16:17
Computed draw call
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement: function () {
this._draw();
},
dataset: function () {
// Calulate dataset
return dataset;
@James1x0
James1x0 / nested-routes.js
Created November 5, 2014 20:19
Nested route behavior w/o view nesting
// router.js
Router.map(function () {
this.resource('employee', { path: 'employees/:id' }, function () {
this.route('index', { path: '/' });
this.route('edit');
});
this.resource('employee.dependent', { path: 'employees/:employeeid/dependents/:dependentid' }, function () {
this.route('index', { path: '/' });
this.route('edit');
@James1x0
James1x0 / Minimalistic-CSS-Loader.markdown
Created November 20, 2014 20:30
Minimalistic CSS Loader

Minimalistic CSS Loader

Fairly minimalistic loader in pure css. Everything is pretty much customizable; check the less var source.

A Pen by James on CodePen.

License.