Skip to content

Instantly share code, notes, and snippets.

Avatar
🍊

Jose Constela joseconstela

🍊
View GitHub Profile
@joseconstela
joseconstela / Crop composition addon for MeteorJS collections
Created Mar 4, 2017
Tiempo de siembra - crop composition addon for MeteorJS collections
View Crop composition addon for MeteorJS collections
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// COMPOSITION
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
composition: {
type: Object,
label: 'Composición (cada 100gr)',
optional: true
},
View Strange Esp8266 behaviour
AT+RST
OK
WIFI DISCONNECT
ets J`n 8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000,,tail 0
chkstm 0x63
@joseconstela
joseconstela / index.js
Created Aug 16, 2016
kafka-node-basic-example
View index.js
"use strict"
let kafka = require('kafka-node'),
HighLevelProducer = kafka.HighLevelProducer,
client = new kafka.Client('localhost:2181/'),
producer = new HighLevelProducer(client)
// In this demo, topics are intended to be created already.
// See kafka docs (or check https://hub.docker.com/r/wurstmeister/kafka/ =>
// "Automatically create topics")
@joseconstela
joseconstela / hosts
Last active Nov 2, 2022
Prevent OSX calling home
View hosts
################################################################################
# Prevent OSX calling home #
# #
# Mix of different /etc/hosts files found over internet, and calls filtered #
# using LittleSnitch for months. #
# #
# OSX sends a huge amount of requests to Cuppertino, even when you don't use #
# Spotlight suggestions, iCloud, updates and other services. Even if they are #
# disabled. #
# #
@joseconstela
joseconstela / tsp.js
Created Jun 29, 2016
TPS genetic algorithm in plain-javascript - to be used with acio-js
View tsp.js
/*
* 0.0.1 - 29.06.16
* Experimental.
*
* Original code: https://github.com/parano/GeneticAlgorithm-TSP
*/
Array.prototype.clone = function() { return this.slice(0); }
Array.prototype.shuffle = function() {
for(var j, x, i = this.length-1; i; j = randomNumber(i), x = this[--i], this[i] = this[j], this[j] = x);
View .travis.yml
language: node_js
node_js:
- '0.10'
sudo: required
before_install:
- curl https://install.meteor.com | /bin/sh
script: meteor test --once --driver-package dispatch:mocha-phantomjs
View actions.test.js
require('./actions');
describe( 'actions tests', () => {
it( 'dilbert', () => {
var actionResult = actions['dilbert']();
assert.typeOf( actionResult, 'object' );
assert.typeOf( actionResult.display, 'object' );
assert.typeOf( actionResult.display.title, 'string' );
assert.typeOf( actionResult.display.link, 'string' );
assert.typeOf( actionResult.display.html, 'string' );
View meteorapp-nginx-site.conf
server_tokens off; # for security-by-obscurity: stop displaying nginx version
# this section is needed to proxy web-socket connections
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
@joseconstela
joseconstela / meteorapp.conf
Last active Jun 29, 2016
MeteorJS application upstart service config file example, as shown at http://joseconstela.com/nginx-config-files-for-production-ready-meteorjs-apps/
View meteorapp.conf
# upstart service file at /etc/init/meteorapp.conf
description "Meteor.js application"
author "Jose Constela <jose@joseconstela.com>"
# When to start the service
start on started mongod and runlevel [2345]
# When to stop the service
stop on shutdown
@joseconstela
joseconstela / env-setup.sh
Last active Dec 3, 2017
My development environment and machine setup. See my dotfiles at https://github.com/joseconstela/dotfiles
View env-setup.sh
################################################################################
## OSX customisations
################################################################################
# Map CAPS key to esc. - https://stackoverflow.com/a/40254864
# Allow repeated keys
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# Time until key repetition
defaults write -g InitialKeyRepeat -int 10