Skip to content

Instantly share code, notes, and snippets.

View juanpicado's full-sized avatar
🌴
holidays

Juan Picado juanpicado

🌴
holidays
View GitHub Profile
@juanpicado
juanpicado / example.ts
Last active August 29, 2015 14:19
typescript example
class Animal {
constructor(public name) { }
move(meters) {
alert(this.name + " moved " + meters + "m.");
}
}
class Snake extends Animal {
move() {
alert("Slithering...");
@juanpicado
juanpicado / Future Promise
Last active August 29, 2015 14:23
Promise future and past
var foo = function(a){
var promise = new Promise();
asyncAjaxFunction(a).done(function(){
promise.resolve();
}).fail(function(){
promise.reject();
})
};
foo.then(function(){
@juanpicado
juanpicado / emitter.js
Last active August 29, 2015 14:23 — forked from brentertz/emitter.js
var util = require('util'),
EventEmitter = require('events').EventEmitter;
var Server = function() {
var self = this;
this.on('custom_event', function() {
self.logSomething('custom_event');
});
@juanpicado
juanpicado / ast.js
Created July 29, 2015 05:58
Estraverse example
var fs = require('fs');
var esprima = require('esprima');
var escodegen = require('escodegen');
var estraverse = require('estraverse');
fs.readFile('test_1.js', 'utf8', function(err, contents) {
var ast = esprima.parse(contents);
estraverse.replace(ast, {
enter : function (node, parent) {
if (node.type === 'Property' && node.key.name.indexOf('jota') != -1) {
this.remove();
@juanpicado
juanpicado / json
Last active August 29, 2015 14:26
bower.json
{
"name": "resources-enme-war",
"version": "1.5.2",
"homepage": "https://github.com/encuestame/encuestame",
"authors": [
"Juan Picado (@jotadeveloper) <[email protected]>"
],
"license": "APL2",
"ignore": [
"**/.*",
@juanpicado
juanpicado / javascript
Created August 8, 2015 17:37
intern grunt task
intern: {
local_browser: {
options: {
runType: 'runner',
config: '<%= dirs.tests %>/intern_local_browser'
}
},
remote_local: {
options: {
runType: 'runner',
@juanpicado
juanpicado / gruntFile.js
Created August 8, 2015 17:38
less and grunt
less: {
development: {
options: {
compress: false,
yuicompress: false,
//sourceMap : true,
optimization: 1
},
files: {
"<%= dirs.css_src %>/tweetpoll.css": "<%= dirs.less_src %>/tweetpoll.less",
@juanpicado
juanpicado / pom.xml
Created August 8, 2015 17:46
grunt and maven
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>0.0.23</version>
<configuration>
<workingDirectory>src/main/resources/resource</workingDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
@juanpicado
juanpicado / esprima.test.js
Last active March 19, 2016 23:31
Esprima example
var ast = esprima.parse("var a;");
// esprima
var ast = esprima.parse("var foo = 'bar';");
// acorn
var ast = acorn.parse('var a;', {
// collect ranges for each node
ranges: true
});