Skip to content

Instantly share code, notes, and snippets.

@ryandabler
ryandabler / Proxy.js
Last active November 30, 2020 00:24
Complete example of proxying an array for this article: https://itnext.io/meta-programming-in-javascript-with-proxies-64fa4898070e
const db = [
{
name: 'John Doe',
age: 28,
lastModified: Date.now(),
lastAccessed: Date.now()
},
{
name: 'Jane Smith',
age: 30,
@haskaalo
haskaalo / tarcheatsheet.md
Last active April 8, 2024 14:19
Tar usage / Tar Cheat Sheet

Tar Usage / Cheat Sheet

Compress a file or directory

e.g: tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

  • -c: Create an archive.
  • -z: Compress the archive with gzip.
  • -v: makes tar talk a lot. Verbose output shows you all the files being archived and much.
  • -f: Allows you to specify the filename of the archive.
@chenglou
chenglou / gist:34b155691a6f58091953
Last active April 5, 2021 19:15
Better feature for React key

key is pretty much crucial for state perservation in React. As of React 0.13 it can't do the following things:

  • Clone state
<Comp key={1} /><Comp key={1} />
  • Preserve component state across different parents:
@cobyism
cobyism / gh-pages-deploy.md
Last active May 17, 2024 10:22
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@defunctzombie
defunctzombie / browser.md
Last active April 10, 2024 17:45
browser field spec for package.json
@crazy4groovy
crazy4groovy / dirHtmlPageRenderToPng.js
Created July 22, 2012 15:57
PhantomJS script to loop through local directory and render HTML pages as PNG
/* tested on PhantomJS 1.6 */
var page = require('webpage').create(), loadInProgress = false, fs = require('fs');
var htmlFiles = new Array();
// console.log(fs.workingDirectory);
// console.log(phantom.args[0]);
var curdir = phantom.args[0] || fs.workingDirectory;
var curdirList = fs.list(curdir);
@hsablonniere
hsablonniere / README.md
Created May 2, 2012 22:42
scrollIntoViewIfNeeded 4 everyone!!!

scrollIntoViewIfNeeded 4 everyone!!!

This gist provides a simple JavaScript implementation of the non-standard WebKit method scrollIntoViewIfNeeded that can be called on DOM elements.

Usage

Just use the code in index.js in your app or website. You can see usage in the test page test.html.

The parent element will only scroll if the element being called is out of the view. The boolean can force the element to be centered in the scrolling area.

@siebertm
siebertm / gist:192658
Created September 24, 2009 10:20
sample fake names
This file has been truncated, but you can view the full file.
GivenName,Surname,StreetAddress,City,ZipCode,EmailAddress,TelephoneNumber
Karolin,Gottlieb,Am Borsigturm 61,Dormagen Zons,41541,Karolin.Gottlieb@dodgit.com,02133 01 62 83
Philipp,Schaefer,Schmarjestrasse 82,Bahnitz,14715,Philipp.Schaefer@pookmail.com,033870 32 38
Claudia,Maurer,Wallstrasse 72,Hammerstein,56598,Claudia.Maurer@pookmail.com,02635 99 06 20
Luca,Neustadt,Ellmenreichstrasse 10,Obertrubach,91286,Luca.Neustadt@mailinator.com,09197 39 92 27
Frank,Schmitz,Borstelmannsweg 32,Coburg,96409,Frank.Schmitz@spambob.com,09561 78 15 75
Ute,Mehler,Flughafenstrasse 59,Weiding,92557,Ute.Mehler@trashymail.com,09673 12 09 48
Marko,Reiniger,Augsburger Straße 20,Herne,44629,Marko.Reiniger@pookmail.com,02323 95 65 13
Anja,Theissen,Leipziger Straße 78,Zierenberg,34289,Anja.Theissen@mailinator.com,05606 71 60 26
Franziska,Bürger,Prenzlauer Allee 6,Markkleeberg,04409,Franziska.Bürger@pookmail.com,0341 86 02 37