Skip to content

Instantly share code, notes, and snippets.

View gillesruppert's full-sized avatar

Gilles Ruppert gillesruppert

View GitHub Profile

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@gillesruppert
gillesruppert / expected html
Created June 27, 2013 10:44
Marionette.CollectionView for a select box
<select> // CollectionView.el
<option value="modelId">Model.name</option> // ItemView for the model
</select>
<!--
can you have Marionette views that do not have a template without overriding the render method? Overriding the render method is painful as you have to implement the `isClosed setting plus all the event triggers, so it keeps working with all the Marionette hooks, or am I mistaken?
-->

{COMPONENT_NAME}

component description and usage

Images supporting the documentation or more extensive documentation should go into the docs folder.

Working example should go into the example folder.

@gillesruppert
gillesruppert / module-boilerplate.js
Created January 18, 2013 14:10
simpler AMD/CJS/Node/Global boilerplate
// AMD support
if (typeof define === 'function' && define.amd) {
define(function () { return Cookies; });
// CommonJS and Node.js module support.
} else if (typeof exports !== 'undefined') {
// Support Node.js specific `module.exports` (which can be a function)
if (typeof module != 'undefined' && module.exports) {
exports = module.exports = Cookies;
}
// But always support CommonJS module 1.1.1 spec (`exports` cannot be a function)
@gillesruppert
gillesruppert / arduino_music.ino
Created January 15, 2013 20:23
Arduino Music script
/* Melody
* (cleft) 2005 D. Cuartielles for K3
*
* This example uses a piezo speaker to play melodies. It sends
* a square wave of the appropriate frequency to the piezo, generating
* the corresponding tone.
*
* The calculation of the tones is made following the mathematical
* operation:
*
@gillesruppert
gillesruppert / gist:4039709
Created November 8, 2012 15:59
Getting different keys at different paths with 1 JSONStream.parse
// given the data structure below, we want to get:
// rows.id and rows.doc._rev.
// JSONStream.parse('rows', true, /id|doc/, /(rev)?/) // doesn't work
{"total_rows":129,"offset":0,"rows":[
{ "id":"change1_0.6995461115147918"
, "key":"change1_0.6995461115147918"
, "value":{"rev":"1-e240bae28c7bb3667f02760f6398d508"}
, "doc":{
"_id": "change1_0.6995461115147918"
@gillesruppert
gillesruppert / setTimeout.js
Created May 16, 2012 14:48
order of setTimeout calls
var i = 0, l = 100;
for (; i < l; i++) {
(function(counter) {
setTimeout(function() {
console.log(counter);
}, 0);
}(i));
}
@gillesruppert
gillesruppert / gist:2571259
Created May 1, 2012 20:49
John Schulz Speakerrate feedback
Speakerrate hates me, so I'm giving feedback this way:
A difficult topic for a conference like Front Trends as you have a divided public: lots of designers/frontenders and quite a few JavaScript/Backend developers.
I thought the talk was well delivered and didn't do the mistake to go into too much detail. It would be over the top for a designer/html person as it talks about REST, streams, etc which are concepts that most designers wouldn't know.
I think however that it's the ideal talk for people who are fairly competent frontend JavaScripters and are interested in node.js or backend developers who use a different technology and are thinking on how they could use node.js in their technology stack.
All in all: well done! It's the 1st time I heard a talk like this (about a backend technology) at a frontend conference and I applaud you for it!
--
Gilles Ruppert
(*
* Google Chrome View Source in MacVim - v0.1 - 3/7/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*)
tell application "Google Chrome"
// 1. Write a class to support the following code:
var Person = function(name) {
this.name = name;
};
var thomas = new Person('Thomas');
var amy = new Person('Amy');
thomas.name; // --> "Thomas"