Skip to content

Instantly share code, notes, and snippets.

View Bigomby's full-sized avatar

Diego Fernández Bigomby

  • Morón de la Frontera, Spain
View GitHub Profile
@miguelmota
miguelmota / nil_check.go
Created February 1, 2019 20:21
Golang check if interface value is nil
package main
import (
"fmt"
"reflect"
)
func main() {
var v *string
fmt.Println(isNil(v)) // true
@axic
axic / roadmap.md
Last active August 11, 2018 20:34
eWASM Roadmap 2017-2018 [Not kept up to date]
@paumoreno
paumoreno / README.md
Last active June 8, 2022 04:41
Extract all messages from a Vue.js with vue-i18n app, using gettext-extractor.

This script uses the great message extraction library gettext-extractor by lukasgeiter.

The script assumes that the location of the source files is ./src. It parses both .js and .vue files. It writes the PO template file in ./i18n/messages.pot.

Some things to note:

  • It assumes that interpolations in the templates use the delimieters {{}} (it is the most commmon case).
  • It assumes that both the template and the script sections of the .vue single file components are defined inline, and not referenced by a src attribue (it is the most common case).
  • Expressions to extract are hardcoded. Currently they are ['$t', '[this].$t', 'i18n.t'].
@alexvandesande
alexvandesande / Random generator
Last active December 23, 2022 09:10
A very simple random generator. A miner can influence the number by not publishing a block with an unwanted outcome, and forfeiting the 5 block reward.
contract random {
/* Generates a random number from 0 to 100 based on the last block hash */
function randomGen(uint seed) constant returns (uint randomNumber) {
return(uint(sha3(block.blockhash(block.number-1), seed ))%100);
}
/* generates a number from 0 to 2^n based on the last n blocks */
function multiBlockRandomGen(uint seed, uint size) constant returns (uint randomNumber) {
uint n = 0;
for (uint i = 0; i < size; i++){
@gallir
gallir / ties.py
Last active December 28, 2015 17:35
Calcula la probabilidad de empate en una votación como la de la CUP simulando resultados
#! /usr/bin/env python
import numpy.random as npr
SIZE=3030
LOOPS=1000000
TIE=SIZE/2
ties=0
@MoOx
MoOx / index.js
Last active February 9, 2024 22:44
Export/import github labels
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
@kachayev
kachayev / concurrency-in-go.md
Last active March 11, 2024 11:27
Channels Are Not Enough or Why Pipelining Is Not That Easy
@mwhite
mwhite / git-aliases.md
Last active April 1, 2024 15:06
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@robertklep
robertklep / clientserver.js
Created May 2, 2013 07:57
client -> socket.io server 1 (clientserver.js) -> socket.io server 2 (serverserver.js)
var app = require('express')()
, server = require('http').createServer(app)
, io = require('socket.io').listen(server);
server.listen(3012);
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});