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 October 29, 2024 04:00
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 December 6, 2024 00:46
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 July 15, 2024 04:13
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
Last active September 19, 2024 10:50
sample fake names for filling your fake databases during software development. Any relation to real people is a coincidence!
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,[email protected],02133 01 62 83
Philipp,Schaefer,Schmarjestrasse 82,Bahnitz,14715,[email protected],033870 32 38
Claudia,Maurer,Wallstrasse 72,Hammerstein,56598,[email protected],02635 99 06 20
Luca,Neustadt,Ellmenreichstrasse 10,Obertrubach,91286,[email protected],09197 39 92 27
Frank,Schmitz,Borstelmannsweg 32,Coburg,96409,[email protected],09561 78 15 75
Ute,Mehler,Flughafenstrasse 59,Weiding,92557,[email protected],09673 12 09 48
Marko,Reiniger,Augsburger Straße 20,Herne,44629,[email protected],02323 95 65 13
Anja,Theissen,Leipziger Straße 78,Zierenberg,34289,[email protected],05606 71 60 26
Franziska,Bürger,Prenzlauer Allee 6,Markkleeberg,04409,Franziska.Bü[email protected],0341 86 02 37