Skip to content

Instantly share code, notes, and snippets.

@begeeben
begeeben / apply-call-bind.js
Last active August 29, 2015 14:01
common javascript scoping problems
// TBC
// call
// apply
// bind
var user = {
firstName: 'Peter',
say: function (message) {
div {
border: 2px transparent solid;
}
.is-active {
border: 2px black solid;
background-color: white;
}
.light {
display: inline-block;
border: 2px solid #888;
border-radius: 50px;
width: 100px;
height: 100px;
margin: 3px;
opacity: 0.3;
}
@begeeben
begeeben / jsbin.gogaj.css
Last active August 29, 2015 14:02
finite state machine example
.light {
display: inline-block;
position: relative;
background-color: black;
border: 3px solid #888;
border-radius: 50px;
width: 100px;
height: 100px;
margin: 3px;
}
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@begeeben
begeeben / develop.js
Last active August 29, 2015 14:26
A handly script to make and run Firefox OS Gaia. Watch for file changes and make on the fly.
// Usage: node make_onsave.js b2g tv browser
// node make_onsave.js nightly phone settings
// node make_onsave.js simulator tv tv-deck
// node make_onsave.js b2g tv
'use strict';
var fs = require('fs');
var path = require('path');
var exec = require('child_process').exec;
{
"card_list": [
{
"type": "Deck",
"deckClass": "application",
"manifestURL": "app://app-deck.gaiamobile.org/manifest.webapp",
"group": "app"
},
{
"type": "Deck",
@begeeben
begeeben / javascript settings
Created October 23, 2015 15:26
sublime settings
{
// Determines what character(s) are used to terminate each line in new files.
// Valid values are 'system' (whatever the OS uses), 'windows' (CRLF) and
// 'unix' (LF only).
"default_line_ending": "unix",
// Set to "none" to turn off drawing white space, "selection" to draw only the
// white space within the selection, and "all" to draw all white space
"draw_white_space": "all",
// A Button Entity for Impact.js
ig.module( 'plugins.button' )
.requires(
'impact.entity'
)
.defines(function() {
Button = ig.Entity.extend({
size: { x: 80, y: 40 },