Skip to content

Instantly share code, notes, and snippets.

View filippomangione's full-sized avatar

Filippo Mangione filippomangione

  • Boolean Careers
  • Milano
View GitHub Profile
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@lastguest
lastguest / google_maps_block_panzoom.js
Created September 11, 2014 13:38
Google Maps : Block Pan&Zoom
// Init
google.maps.event.addDomListener(window, 'load', function() {
var map_container = document.getElementById("map-canvas");
var minZoomLevel = 2;
var startZoomLevel = 8;
var map = new google.maps.Map(map_container,{
center: new google.maps.LatLng(-34.397, 150.644),
@basham
basham / css-units-best-practices.md
Last active April 29, 2024 10:40
CSS Units Best Practices

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units

@staltz
staltz / introrx.md
Last active May 10, 2024 12:08
The introduction to Reactive Programming you've been missing
@JamieMason
JamieMason / annotated-jshintrc.txt
Created June 13, 2014 10:59
An annotated .jshintrc file, based on the docs at http://jshint.com/docs/options.
{
/**
* Tell JSHint about global variables.
*/
"predef": [
// https://github.com/pivotal/jasmine
"after",
"afterEach",
@demisx
demisx / angularjs-providers-explained.md
Last active March 17, 2024 11:09
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@lastguest
lastguest / dehydrateFloat.js
Created February 14, 2014 19:13
JavaScript Fixed Float Dehydratation
// Assuming 5 fixed digits
function dehydrateFloat(f){
return Math.floor(f.toFixed(5)*100000).toString(36);
}
function hydrateFloat(dryf){
return (parseInt(dryf,36)/100000).toFixed(5);
}
@Paratron
Paratron / agents.md
Last active February 26, 2024 12:28
Social Network Crawler User Agents

#Social Network Crawler User Agents Users can post URLs on a lot of different platforms nowadays. Most of those platforms will send a request to that URL to generate some preview data from it.

These are a couple of user agents I quickly tested out.

##Facebook

facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@lastguest
lastguest / JavascriptMiddlewares.js
Created September 20, 2013 15:50
Wrap a function with a middleware decorator.
// Generate a middleware
function middleware(mw){
return function(fn){
fn = (typeof fn == "function") ? fn : window[fn];
return function(){
var args = arguments || [];
if(false !== mw.apply(this,args)) fn.apply(this,args);
};
};
}