Skip to content

Instantly share code, notes, and snippets.

define([
'bluebird',
'bootbox'
], function(
Bluebird,
bootbox
) {
'use strict';
return {
<?php
$needles = array(
'/fizz/buzz'
);
$haystack = '/var/tmp/fizz/buzz';
$fileMatched = array_reduce(
$needles,
function($carry, $needle) use ($haystack) {
$ docker run -it --rm phusion/passenger-full /sbin/my_init -- bash -l
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
No SSH host key available. Generating one...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
Creating SSH2 ED25519 key; this may take some time ...
invoke-rc.d: policy-rc.d denied execution of restart.
*** Running /etc/rc.local...
*** Booting runit daemon...
define([
'chaplin'
], function(
Chaplin
) {
'use strict';
return Chaplin.View.extend({
bind : function(callback)
var guarantorFetchedPromise = $.Deferred();
var collateralFetchedPromise = $.Deferred();
this.guarantorCollection.fetch({
success: guarantorFetchedPromise.resolve,
error: guarantorFetchedPromise.reject
})
this.collateralCollection.fetch({
success: collateralFetchedPromise.resolve,
error: collateralFetchedPromise.reject
this.listenTo(this.model, 'change', this._onModelChange);
initialize: function()
{
// Only save every second at most
this._save = _.debounce(this._save, 1000);
},
_onModelChange: function()
{
@cmwelsh
cmwelsh / list.md
Last active December 17, 2015 16:39
CSS Framework Priorities
  • Use classes for everything as much as possible (no ID selectors, no tag selectors)
  • Use a special prefix for classes to attach page-specific interaction JavaScript, e.g. .js-affiliates-table
  • Use * { box-sizing: border-box; } as the rule, not the exception
  • Widgets are always preferable over page-specific styles
    • Widgets can be broken down into 1.) framework widgets (buttons/wells/tables) - these are re-usable across projects and 2.) app-specific widgets (dependencies not filled widget, notification widget, etc.) - these are project specific
  • Pay attention to typography using simple guidelines
    • Pick a base line height
    • Size all line heights as multiples of the base line height when possible
    • Attempt to establish vertical rhythm of all block element heights
  • Use the line-height as the correct multiple for vertical margin above and below elements
@cmwelsh
cmwelsh / gist:5249684
Last active December 15, 2015 10:59
SCSS Style Guide attempt 1
// List each selector on its own line
.foo-bar,
.widget-baz {
// List these 4 attributes in a section at the top
// List them in this order
position: absolute;
left: 10px;
top: 10px;
// Store z-index in a central location
z-index: $foo-bar-z-index;
@cmwelsh
cmwelsh / player-chat.js
Last active December 14, 2015 11:38
Learn2D NPC Script Example
// NPC by cmwelsh
//#CLIENTSIDE
this.onPlayerChats = function () {
if (this.player.chat === 'warp') {
this.player.x = 30;
this.player.y = 35;
}
}
@cmwelsh
cmwelsh / github.css
Created February 21, 2013 01:01
Fork on GitHub
/* Left will inherit from right (so we don't need to duplicate code */
.github-fork-ribbon {
/* The right and left lasses determine the side we attach our banner to */
position: absolute;
/* Add a bit of padding to give some substance outside the "stitching" */
padding: 2px 0;
/* Set the base colour */
background-color: #9b0024;