Skip to content

Instantly share code, notes, and snippets.

View rafaelrinaldi's full-sized avatar

Rafael Rinaldi rafaelrinaldi

View GitHub Profile
@getify
getify / gist:86683eeaa13ac7474f04
Last active August 29, 2015 14:01
proposal: layered npm packages

Here's a quick proposal for something that I think would help npm packages (used as dependencies) be leaner, reducing burden of disk-space and bandwidth, especially for CI type setups which re-download tons of packages over and over again. My idea is inspired from Help People Consume Your npm Packages.

TL;DR

Add .npmignore-minimal file with things in your package that are not-strictly-necessary (readmes, tests, etc) to filter out of minimal-package installs. npm install still installs full package. npm min-install (or npm install --production) installs only the filtered down package contents (aka "minimal-package").

Details

This proposal pairs/parallels devDependencies, but extends this "optional" idea to your whole package structure.

@silviopaganini
silviopaganini / profanity_pt-br
Created June 3, 2014 14:47
Portuguese Profanity
acéfalo
aidético
aids
amadoras
amateur
anal
ânus
arde
ardencia
arder
var Toggler = require('./toggler');
var React = require('react/addons');
var assert = chai.assert;
var Simulate = React.addons.TestUtils.Simulate
describe('Toggler', function(){
var toggler, el;
beforeEach(function() {
@remy
remy / unref.js
Created June 6, 2014 16:55
The `setTimeout` does't actually run, because the event loop is done and we've `unref`ed the timer.
'use strict';
var timer = setTimeout(function () {
console.log('I AM ALIVE!');
}, 1000);
timer.unref();
console.log('Going to lay down now. Right now.');
manager dist manifest export ignore include entry
npm npm package.json cjs .npmignore #main
bower git bower.json umd #ignore #main
component git component.json umd #files #main
spm git package.json#spm umd .spmignore #output #main
packagist git composer.json umd
ender npm package.json cjs .npmignore #ender
dojo ??? package.json#dojoBuild umd #dojoBuild
jspm npm/git package.json#jspm any #ignore #files #main
function Track(src, spriteLength, audioLead) {
var track = this,
audio = document.createElement('audio');
audio.src = src;
audio.autobuffer = true;
audio.load();
audio.muted = true; // makes no difference on iOS :(
/* This is the magic. Since we can't preload, and loading requires a user's
input. So we bind a touch event to the body, and fingers crossed, the
@polarblau
polarblau / atf.js
Last active August 29, 2015 14:11
Apple trailers in fullscreen: save as bookmarklet, start a trailer video on trailers.apple.com, run the script.
javascript:(function(){try{var video=find('.moviePanel object embed');var origWidth=video.width,origHeight=video.height,origStyleWidth=video.style.width,origStyleHeight=video.style.height;onEnterFullscreen(function(){video.width='100%';video.height='100%';video.style.width='100%';video.style.height='100%';});onExitFullscreen(function(){video.width=origWidth;video.height=origHeight;video.style.width=origStyleWidth;video.style.height=origStyleHeight;});fullscreen(video);}catch(e){}function getVideoSize(video){return[video.width,video.height,video.style.width,video.style.height];}function setVideoSize(video,size){video.width=size[0];video.height=size[1];video.style.width=size[2];video.style.height=size[3];}function find(query){return document.querySelector(query);}function isFullscreen(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;}function onFullscreenChange(cb){document.addEventListener('fullscreenchange',cb,false);document.ad
@diegoeis
diegoeis / rinaldi-http2.md
Created June 18, 2015 18:27
Anotações da palestra do Rafael Rinaldi no #17elw em 2015

Rafael Rinaldi

HTTP/2

  • HTTP é a comunicação entre o servidor e o client.
  • A web depende do TCP/IP, que é podemos falar que é uma suite de ferramentas.
  • O HTTP usa o TCP para fazer a transferencia de dados e informação.
  • O IP é responsável por conectar uma rede a outra
  • O TCP é o mecanismo que permite transmitir essas informações.
  • Imagine que tem o terminal A, que você quer mandar para B. O TCP quebra esse arquivo em vários fragmentos. O TCP vai organizar esses fragmentos no ponto B.
  • IP conecta os pontos na rede, o TCP é a camada de dados.
// the old, lame way
protected var _property:Property;
public function get property():Property
{
if (!_property)
{
_property = new Property();
}
@fefranca
fefranca / wallpaperize.sh
Created April 15, 2011 14:58
Convert all jpgs in the current directory to their own individual zips
#!/bin/sh
# Convert all jpgs in the current directory to their own individual zips
for f in `ls *.jpg`; do
z=`echo $f | grep -Eo '(.+)\.'`zip;
echo $'\e[32m' "$f -> $z" $'\e[0m'
zip $z $f
done