Skip to content

Instantly share code, notes, and snippets.

View jose-neta's full-sized avatar

José Neta jose-neta

  • 50NOS.pt
  • Porto area, Portugal
View GitHub Profile
@jose-neta
jose-neta / x-hipchat
Last active August 29, 2015 14:10 — forked from melo/x-hipchat
#!/usr/bin/env perl
use strict;
use warnings;
use JSON 'encode_json';
use HTTP::Tiny;
use Getopt::Long;
use Encode 'decode';
my %opts = (room => $ENV{HIPCHAT_ROOM}, notify => 1);
@jose-neta
jose-neta / .tmux.conf
Created October 15, 2014 16:54
My tmux conf
# Proudly robbed from ISBN-13: 978-1-934356-96-8
#
# Setting the prefix from C-b to C-a
set -g prefix C-a
# Allow you to use C-a from bash
# 10x 2 http://stackoverflow.com/questions/11557076/if-i-set-key-bind-of-c-b-to-c-a-in-tmux-how-can-i-move-the-cursor-to-the-beginni
bind-key C-a send-prefix
@jose-neta
jose-neta / method_signatures
Created October 14, 2014 15:13
How Function::Parameters works
#! /usr/bin/env perl
#https://metacpan.org/pod/Function::Parameters
use Data::Dumper;
use feature 'say';
use Function::Parameters qw(:strict);
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@jose-neta
jose-neta / integer_required
Created September 16, 2014 13:35
angular double validation
<fieldset class="form-group">
<input ng-model="intervalCtrl.interval.distance"
type="number" min="50" max="20000" class="form-control"
placeholder="distance" title="Distance" integer required>
</fieldset>
@jose-neta
jose-neta / gistme
Last active August 29, 2015 14:06
how to create a gist from CLI
#!/bin/bash
if [ ! $GIST_TOKEN ]
then
echo GIST_TOKEN is missing
exit 1
fi
if [ "$#" -ne 3 ]; then
echo 'USAGE: GIST_TOKEN=secret '$0' "the description" public "the filename" < content'
@jose-neta
jose-neta / initialization
Created September 11, 2014 11:11
initialization
var x = {}; var v = ["alpha", "bravo", "charlie" ]; [ "a", "b", "c" ].forEach(function(e,i,a){ x[e] = v[i] });
@jose-neta
jose-neta / gist:433a45be0a862816ad2b
Last active August 29, 2015 14:06
print some variables
(function() {
var system = require('system'),
fs = require('fs')
data = {
"header": {
"days": "wg_fcst_tab_data_1.fcst['3'].hr_d",
"hours": "wg_fcst_tab_data_1.fcst['3'].hr_h"
},
"wind": {
"speed": "wg_fcst_tab_data_1.fcst['3'].WINDSPD",
@jose-neta
jose-neta / phantomjs scraping
Created September 10, 2014 15:37
Again a quirk
; // Varzim Lazer Scraper
(function(){
var system = require('system')
, fs = require('fs')
;
var page = require('webpage').create(),
url= 'http://www.varzimlazer.com/natacao/',
location_regex = new RegExp(url)
@jose-neta
jose-neta / steps
Last active August 29, 2015 14:06
A way of creating a list of step to feed phantomjs
;// A way of creating a list of step to feed phantomjs
(function(){
steps = [{
'action' : function(args){
console.log( 'hello, here are my params: ', args.join(' ') );
},
'params' : {
'alpha' : 'a',
'bravo' : 'c',
'delta' : 'd'