Skip to content

Instantly share code, notes, and snippets.

Avatar

Alan Hoffmeister alanhoff

View GitHub Profile
@alanhoff
alanhoff / readme.md
Last active Feb 24, 2017
Cross compile Rust
View readme.md

Packages

  • Windows x86_64: sudo apt-get install gcc-mingw-w64
  • ARM sudo apt-get install arm-linux-gnueabihf-cpp-4.8
  • PowerPC sudo apt-get install gcc-powerpc-linux-gnu

Config

Create a file inside PROJECT/.cargo/config with the followig content

@alanhoff
alanhoff / http-shield-proxy.js
Created May 13, 2015
Proxy que valida os dados
View http-shield-proxy.js
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer();
var http = require('http');
var Mock = require('mock-req');
var Busboy = require('busboy');
var config = {
url: '/teste', // A rota a ser protegida
method: 'POST', // O método a ser protegido
content: 'multipart/form-data', // O tipo de conteúdo
View gist:8af5b01b9d2bc72a6c51
'use strict';
exports.seed = function(knex, Promise) {
var players = knex('players');
var users = knex('users');
return new Promise(function(resolve, reject) {
View assinatura.pgp
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Doação de 0,69031 BTC feita por Filipe Deschamps
-----BEGIN PGP SIGNATURE-----
Version: Keybase OpenPGP v2.0.8
Comment: https://keybase.io/crypto
wsFcBAABCgAGBQJU8l8yAAoJEKafEHSe9dofDXsQAJm3iJj5Qij2yfmaFErsw+ih
XPuJGNOGTTKw7qcYmin9KcaPv7C976/X6wb9Cjn2S48bQTjx+5IoF7BVbDyXsy6D
View doacao.pgp
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Doação de R$ 10,00 feita por Alan Hoffmeister
-----BEGIN PGP SIGNATURE-----
Version: Keybase OpenPGP v2.0.8
Comment: https://keybase.io/crypto
wsFcBAABCgAGBQJU8MhuAAoJEKafEHSe9dof6poP/i+fPda8i6SCq3bWmdInHGdC
Ecz1BLqrvQztfjTddStmpqM5hrveuj41tkqMLx/FvOs71TR5fMdW9hNbHBProlTh
View gist:da9ea95c5eb02794663d
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
var image = new Image();
image.src = 'data:image/jpg;base64,seu_buffer_transformado_em_base64';
image.onload = function() {
ctx.drawImage(image, 0, 0);
};
View gist:b7ba2a977904367ac483
<script type="text/javascript">
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = bundle; // pegar esse bundle no cookie
script.async = true;
var body = document.getElementsByTagName('body')[0];
body.appendChild(script);
</script>
@alanhoff
alanhoff / arr.js
Created Dec 30, 2014
Array assíncrona
View arr.js
var arr = [1, 2, 3, 4];
(function it(i){
if(arr[i] === undefined)
return console.log('Acabou!');
console.log('Estou no elemento', arr[i]);
// Quando estiver pronto chama o it de novo
setTimeout(it.bind(null, ++i), 1000);
@alanhoff
alanhoff / index.js
Created Dec 16, 2014
requirebin sketch
View index.js
window.shortid = require('shortid');
View loop.js
(function loop(){
fazerAlgoAssincrono(function(err){
if(err)
throw err;
process.nextTick(loop);
});
})()
You can’t perform that action at this time.