Skip to content

Instantly share code, notes, and snippets.

View gmlnchv's full-sized avatar

Georgy Malanichev gmlnchv

View GitHub Profile
@peteboere
peteboere / jquery.alterclass.js
Created December 24, 2011 12:49
jQuery alterClass plugin: Remove element classes with wildcard matching. Optionally add classes.
/**
* 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
*
*/
@jamtur01
jamtur01 / generate_navigation.rb
Created May 20, 2012 21:28
Auto-generates navigation menu for Jekyll sites using pages based on subdirectories and contents
# Auto-generates navigation
# {% generate_navigation %}
#
require 'pathname'
module Jekyll
class Page
def source_path
File.join(@dir, @name).sub(%r{^/*},'')
@markdurrant
markdurrant / _fluid-grid-generator-mixin.scss
Created August 13, 2012 16:10
Sass fluid grid generator mixin based on Twitter Bootstrap fluid grid.
// =======================================================================
// Fluid Grid Generator Mixin
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Based on fluid grid from http://twitter.github.com/bootstrap/
// =======================================================================
//
//
// Parameters
// =======================================================================
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active July 7, 2024 19:32
A badass list of frontend development resources I collected over time.
@cullymason
cullymason / Laravel_Ember.md
Last active December 20, 2015 21:38
It would be nice if we had a plugin that allows Laravel to play nice with Ember. Put simply I would like to create an easy way for Laravel to output JSON strings in a way that Ember likes.

Basic Explaination

It would be nice if we had a plugin that allows Laravel to play nice with Ember. Put simply I would like to create an easy way for Laravel to output JSON strings in a way that Ember likes.

What Laravel Does

return Model::find($id);
@katowulf
katowulf / 1_query_timestamp.js
Last active September 21, 2023 20:28
Get only new items from Firebase
// 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());
});
@chrismccoy
chrismccoy / gitcheats.txt
Last active July 16, 2024 11:44
git cheats
# 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
@vincentorback
vincentorback / debounce-es2015.js
Last active July 22, 2024 11:49
Smarter debouncing
export function debounce (fn, wait = 1) {
let timeout
return function (...args) {
clearTimeout(timeout)
timeout = setTimeout(() => fn.call(this, ...args), wait)
}
}
@danieldunderfelt
danieldunderfelt / StoreContainer.js
Created October 28, 2016 15:36
next.js global store that persists between routes
/**
* 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
@developit
developit / unistore.js
Last active September 8, 2020 15:13
Update: the newer & better version of this is published: https://github.com/developit/unistore
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' }
*/