Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
/** | |
* jQuery alterClass plugin | |
* | |
* Remove element classes with wildcard matching. Optionally add classes: | |
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' ) | |
* | |
* Copyright (c) 2011 Pete Boere (the-echoplex.net) | |
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php | |
* | |
*/ |
// ======================================================================= | |
// Fluid Grid Generator Mixin | |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
// | |
// Based on fluid grid from http://twitter.github.com/bootstrap/ | |
// ======================================================================= | |
// | |
// | |
// Parameters | |
// ======================================================================= |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
// assumes you add a timestamp field to each record (see Firebase.ServerValue.TIMESTAMP) | |
// pros: fast and done server-side (less bandwidth, faster response), simple | |
// cons: a few bytes on each record for the timestamp | |
var ref = new Firebase(...); | |
ref.orderByChild('timestamp').startAt(Date.now()).on('child_added', function(snapshot) { | |
console.log('new record', snap.key()); | |
}); |
# alias to edit commit messages without using rebase interactive | |
# example: git reword commithash message | |
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f" | |
# count total commits in a repo | |
git rev-list --all --count | |
# edit all commit messages | |
git rebase -i --root |
export function debounce (fn, wait = 1) { | |
let timeout | |
return function (...args) { | |
clearTimeout(timeout) | |
timeout = setTimeout(() => fn.call(this, ...args), wait) | |
} | |
} |
/** | |
* PROBLEM: | |
* In next.js, each route points to a distinct top-level component. | |
* Since there is no higher-level components in next.js, how to have | |
* a store that persists between route changes is not immediately | |
* obvious. One solution is this: a higher-order component that you | |
* wrap each of your top-level route components with. | |
* | |
* This is borrowed from next.js' Redux example from here: | |
* https://github.com/zeit/next.js/wiki/Redux-example |
import { h, Component } from 'preact'; | |
/** Creates a new store, which is a tiny evented state container. | |
* @example | |
* let store = createStore(); | |
* store.subscribe( state => console.log(state) ); | |
* store.setState({ a: 'b' }); // logs { a: 'b' } | |
* store.setState({ c: 'd' }); // logs { c: 'd' } | |
*/ |