This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Command Line to run from terminal | |
# Logs result to file s3_backup.log | |
# Command will run in the background | |
s3cmd sync -v /path/to/folder/ s3://s3-bucket/folder/ > s3_backup.log 2>&1 & | |
# Crontab command to sync folder to S3 | |
# Command will run 1am every day and logs result to /root/s3_backup.log | |
0 1 * * * /usr/bin/s3cmd sync -rv /path/to/folder/ s3://s3-bucket/folder/ >> /root/s3_backup.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From: /../gems/activerecord-4.1.11/lib/active_record/attribute_methods.rb @ line 129 ActiveRecord::AttributeMethods::ClassMethods#method_defined_within?: | |
128: def method_defined_within?(name, klass, superklass = klass.superclass) # :nodoc: | |
=> 129: if klass.method_defined?(name) || klass.private_method_defined?(name) | |
130: if superklass.method_defined?(name) || superklass.private_method_defined?(name) | |
131: klass.instance_method(name).owner != superklass.instance_method(name).owner | |
132: else | |
133: true | |
134: end | |
135: else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.ts | |
@RouteConfig([ | |
{ path: '/login', name: 'Login', component: LoginFormCmp, useAsDefault: true }, | |
{ path: '/home', name: 'Home', component: HomeCmp}, | |
{ path: '/system/health', name: 'SystemHealth', component: SystemHealthCmp } | |
]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main.ts | |
import {provide} from 'angular2/core'; | |
import {bootstrap} from 'angular2/platform/browser'; | |
import {ROUTER_PROVIDERS, LocationStrategy, PathLocationStrategy, APP_BASE_HREF } from 'angular2/router'; | |
import {HTTP_PROVIDERS} from 'angular2/http'; | |
import {Notification} from './scripts/services/notifications'; | |
import {SessionService} from './scripts/services/session.service'; | |
import {UUHttp} from './scripts/services/uuHttp'; | |
import {AppCmp} from './scripts/views/app'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (c) copyright unscriptable.com / John Hann | |
// License MIT | |
// For more robust promises, see https://github.com/briancavalier/when.js. | |
function Promise () { | |
this._thens = []; | |
} | |
Promise.prototype = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { isLoggedIn } from '../../common/utils'; | |
class App extends React.Component { | |
componentWillMount() { | |
isLoggedIn(); // is undefined | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Promise.all is good for executing many promises at once | |
Promise.all([ | |
promise1, | |
promise2 | |
]); | |
// Promise.resolve is good for wrapping synchronous code | |
Promise.resolve().then(function () { | |
if (somethingIsNotRight()) { | |
throw new Error("I will be rejected asynchronously!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// === Arrays | |
var [a, b] = [1, 2]; | |
console.log(a, b); | |
//=> 1 2 | |
// Use from functions, only select from pattern | |
var foo = () => [1, 2, 3]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Service from 'path/to/service'; | |
import 'jasmine-ajax' | |
describe('Service', () => { | |
let request, promise; | |
let instance = Service; | |
let payload = {foo:'bar'}; | |
let path = '/path'; | |
let callback = jasmine.createSpy('callback'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias gitclean="git branch | grep -v master | xargs git branch -d" | |
alias dockerclean="docker rm $(docker ps -a -q) && docker rmi $(docker images -q)" | |
alias gca="git commit --amend --no-edit" |