Skip to content

Instantly share code, notes, and snippets.

Nicolas Kermarc spacenick

Block or report user

Report or block spacenick

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View accordion_react.js
class Tab extends React.Component {
static propTypes = {
render() {
return ...
spacenick / module.js
Created Apr 20, 2015
private functions
View module.js
/// Everything defined here is defined in the scope of that module
/// so it wont pollute anything
var privateVar = "test";
var privateFn = function() {
// process stuff here
// we can use privateVar
spacenick /
Last active Aug 29, 2015
Save batches of objects

You need the async library for this function

var saveBatch = function(source, callback, limit) {
	limit = limit || 20;
    var nbSlices = Math.ceil(source.length / limit), i = 0;
    async.whilst(function() {
        return i < nbSlices;
View states.js
.state('items', {
abstract: true,
url: "/items",
resolve :{
items: ['DataSource', function(DataSource) {
return DataSource.fetchItems();
spacenick / gist:5397435
Last active Dec 16, 2015
Adding item to a relation on Parse
View gist:5397435
// You can do that in your Chrome Console
// Load the initial object, like an Attempt
var attempt = new Parse.Object("Attempt"); = "myId";
// Get the relation "handler" from the attempt object
var relation = attempt.relation("products");
spacenick /
Created Dec 12, 2012
Add live re-precompiling of handlebars templates with Yeoman/Grunt server every time you create/edit a template

In your project root:

npm install grunt-handlebars

Then edit your Gruntfile and add BEFORE the initConfig statement :


Add to your Grunt config the following part

You can’t perform that action at this time.