Skip to content

Instantly share code, notes, and snippets.

View AlexxNica's full-sized avatar
🚀

Alexandre Nicastro AlexxNica

🚀
View GitHub Profile
@marcoscaceres
marcoscaceres / appcache usage
Created February 15, 2014 12:40
Usage of appcache in top 78K sites
03/metalsucks.net_03ad4a57310603e099309e1d17b91b75.html.txt
09/sage.de_09e950ff455f7b2142590c9da5e9dd94.html.txt
0d/timer-tab.com_0d8b2d84436fdb8599c14fa35d925046.html.txt
0e/revolt.tv_0e150c2ee3bee3933d413b765e240ed4.html.txt
10/zoso.ro_10597f0db5b5e117924695efaf3fc2af.html.txt
18/informationisbeautiful.net_1887487e0d57043bb6e34af8c7570882.html.txt
19/foodnetwork.co.uk_19d2a2808cc0c636b68a530e79152092.html.txt
22/refinery29.com_225607c0d6068facaffc61e241d255b7.html.txt
28/tyinternety.cz_2899325c517d633c2ab1cbe774d196ac.html.txt
37/viralheat.com_372db88a6013a38e7b59f89ff7340e88.html.txt
@marcoscaceres
marcoscaceres / single page apps
Last active March 13, 2017 14:23
This data is for applications that declare "apple-mobile-web-app-capable" (yes). It is an attempt to understand that installable web-app landscape. The data was taken from webdevdata.org. Of that 1097 sites contained the string "apple-mobile-web-app-capable", of which 360 sites where analyzed in this survey.
site,icons,mobile,navigates
10news.com,0,1,0
1x.com,1,1,1
220-volt.ru,1,1,0
22s.com,1,1,0
411.info,1,1,0
538.nl,1,1,0
a4academics.com,0,1,0
actressphoto.org,0,1,0
acuityscheduling.com,1,1,0
@dannysmith
dannysmith / osx_setup.sh
Last active June 20, 2025 14:08
Sensible defaults for New Mac
#!/usr/bin/env bash
# ~/.osx — http://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active June 8, 2025 15:03
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@trevnorris
trevnorris / perf-flame-graph-notes.md
Last active December 24, 2023 05:25
Quick steps of how to create a flame graph using perf

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
@cowboy
cowboy / inception.js
Last active May 5, 2024 09:10
JavaScript: inception(inception);
function inception(f) {
try {
return 'recursion puts the "' + f.name + '" in "' + f(f) + '"';
} catch (e) {
return '';
}
}
@jebeck
jebeck / README.md
Last active May 30, 2023 05:03
SVG foreignObject tooltips in D3

SVG foreignObject tooltips in D3

Just a little proof-of-concept here - using an SVG <foreignObject> element as a container for a tooltip that can involve handy HTML features like text-wrapping and (semi-)dynamic sizing.

Gotchas so far:

  • Like an <svg> element, a <foreignObject> element needs a width and a height in order to be rendered.

  • However, specifying width and/or height can be delayed. Here I specify a width (foWidth) of 300px, then find the height of the contained <div> using getBoundingClientRect() and use that to specify the height of the containing <foreignObject>.

@ttuegel
ttuegel / config.nix
Created June 2, 2014 19:07
Use packages from config.nix in shell.nix
pkgs:
{
packageOverrides = pkgs: with pkgs; rec {
hsDevTools = hsPkgs: [
hsPkgs.cabalInstall
hsPkgs.ghcMod
];
};
}
@samgiles
samgiles / flatMap.js
Created June 20, 2014 11:32
Javascript flatMap implementation
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (:
Array.prototype.flatMap = function(lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
};
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then