Skip to content

Instantly share code, notes, and snippets.

@getify
getify / gist:86683eeaa13ac7474f04
Last active Aug 29, 2015
proposal: layered npm packages
View gist:86683eeaa13ac7474f04

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.

View profanity_pt-br
acéfalo
aidético
aids
amadoras
amateur
anal
ânus
arde
ardencia
arder
View test.js
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 Jun 6, 2014
The `setTimeout` does't actually run, because the event loop is done and we've `unref`ed the timer.
View unref.js
'use strict';
var timer = setTimeout(function () {
console.log('I AM ALIVE!');
}, 1000);
timer.unref();
console.log('Going to lay down now. Right now.');
View package-managers.md
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
@fdaciuk
fdaciuk / exceptions.js
Created Aug 23, 2014
Tumblr Exceptions
View exceptions.js
/* jslint browser: true, jquery: true, devel: true*/
/*
Dependencies: Tumblr.Flags
Tumblr.Utils.exceptions will automatically log window.onerror.
DO NOT write code like this. This is written to handle weird cases
where normal code should probably just fail.
*/
View audiosprite.js
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 Aug 29, 2015
Apple trailers in fullscreen: save as bookmarklet, start a trailer video on trailers.apple.com, run the script.
View atf.js
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 Jun 18, 2015
Anotações da palestra do Rafael Rinaldi no #17elw em 2015
View rinaldi-http2.md

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.