Skip to content

Instantly share code, notes, and snippets.

View expalmer's full-sized avatar

Palmer Oliveira expalmer

View GitHub Profile
@expalmer
expalmer / gist:cfbaf085256d5902ce2d
Last active August 29, 2015 14:05
Simple Require AMD
(function( context ) {
'use strict';
var modules = {};
var app = {
getDependencies: function( deps ) {
@expalmer
expalmer / gist:beca5945f19792228900
Last active August 29, 2015 14:05
Metalsmith Gist Embed Plugin
/**
* Module dependencies.
*/
var request = require('request');
var Q = require('q');
/**
* GistEmbed prototype.
*/
@expalmer
expalmer / gist:5f1693761a94c215cb23
Created August 16, 2014 19:26
Vazio é true ou false ? by @wbruno
# PHP
$ php -r "var_dump( (boolean)'') .PHP_EOL;"
bool(false)
# NodeJs
$ node
> !!""
false
# ShellScript
@expalmer
expalmer / gist:4bc6203dc2a3f7134e78
Last active August 29, 2015 14:05
Metalsmith Gist Test Example
var Animal = function ( name ) {
this.name = name;
}
Animal.prototype.getName = function () {
return this.name;
}
var tiger = new Animal('Tiger');
tiger.getName();
@expalmer
expalmer / gist:bb2266b59e2accb0499e
Created September 12, 2014 19:51
Error saving authentication: Error: read ECONNRESET
var OrtcNodeclient = require('ibtrealtimesjnode').IbtRealTimeSJNode;
var connectionUrl = 'http://ortc-developers.realtime.co/server/2.1/';
var appKey = 'myAppKey';
var authToken = 'myToken';
var channel = 'MyChannel';
var privateKey = 'myPrivateKey';
var isCluster = true;
@expalmer
expalmer / Estrutura de arquivos do Blog.
Last active August 29, 2015 14:06
blog - Metalsmith, um extremamente simples gerador de páginas estáticas feito em Javascript
[blog]
--- index.js
--- package.json
--- [src]
------- index.md
------- [posts]
------------- post-1.md
------------- post-2.md
--- [templates]
------- index.hbt
@expalmer
expalmer / react1.js
Last active August 29, 2015 14:07
React Example
/** @jsx React.DOM */
var Hello = React.createClass({
getInitialState: function() {
return { title: 'Hello World' };
},
render: function() {
return <div><h1>{this.state.title}</h1></div>;
}
@expalmer
expalmer / I18n.js
Created March 4, 2015 13:09
I18n for my react progress form
;(function ( I18n, undefined ) {
var defaultLocale = "en-US";
I18n.locale = defaultLocale;
I18n.translations = [];
I18n.translations["en-US"] = {
name: {