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
package math
import "testing"
// Sum does the sum of 2 integers
func Sum(a, b int) int {
return a + b
}
// setup run before and after a test case or sub test.
@jose-neta
jose-neta / keybase.md
Created November 4, 2016 18:25
My keybase.io proof

Keybase proof

I hereby claim:

  • I am netp on github.
  • I am joseneta (https://keybase.io/joseneta) on keybase.
  • I have a public key ASCwKQjqy4xSRLaiUqsuoGvPbYKpkRlyW6ZDUf_livIuiAo

To claim this, I am signing this object:

@jose-neta
jose-neta / bitbucket.js
Created October 6, 2016 23:49 — forked from webaware/bitbucket.js
Some bookmarklets for setting tab-size to 4 on GitHub, Gist, and Bitbucket. NB: they all work in Chrome, but the GitHub and Gist ones don't work in Firefox (as at v31) because of its implementation for honouring CSP headers.
javascript:(function(){var style=document.createElement('style'),css=document.createTextNode('.refract-container .source{-moz-tab-size:4;tab-size:4;}');style.appendChild(css);document.getElementsByTagName('head')[0].appendChild(style);})();

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@jose-neta
jose-neta / spread_operator.js
Last active June 9, 2016 10:52
Javascript's spread operator
#!/usr/bin/env node
(function(){
'use strict';
var x = [1, 2, 3, 4, 5, 6, 7, 8, 9]; // => 1 2 3 4 5 6 7 8 9
console.log(...x); // =>
var y = function (a, b, c) {
@jose-neta
jose-neta / Dockerfile
Created October 16, 2015 13:30 — forked from benschw/Dockerfile
MySQL Docker Container
FROM ubuntu
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -s /bin/true /sbin/initctl
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install mysql-client mysql-server
#!perl
# source: http://www.perlmonks.org/?node_id=575918
use warnings;
use strict;
use Benchmark;
timethese(1_000_000, {
#!perl
# source: http://www.perlmonks.org/?node_id=575918
use warnings;
use strict;
use Benchmark;
timethese(1_000_000, {
#!perl
use warnings;
use strict;
use Benchmark qw( timethese );
my ( $preinc, $postinc ) = ( 0, 0 );
timethese(100_000_000, {
#!perl
use warnings;
use strict;
use Benchmark qw( cmpthese );
my $h0 = {
'h1' => {
'h2' => {