Skip to content

Instantly share code, notes, and snippets.

View asvny's full-sized avatar
🎯
Focusing

Annamalai Saravanan asvny

🎯
Focusing
View GitHub Profile
@twolfson
twolfson / README.md
Last active November 26, 2019 18:27
CSS selector minifier concept

CSS selector minification is a missed opportunity of saved bytes. Currently, Google uses it but not much beyond that.

The concept is change .box to .b and <div class="box"> to <div class="b">.

There is room for issues with JavaScript so that should be treated as a nice-to-have and be conservatively avoided.

Approach

To convert HTML and CSS, it would be a 2 step process:

Minify CSS selectors

@lemiorhan
lemiorhan / post-receive
Last active October 13, 2025 02:29
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@tk120404
tk120404 / linkedlist.js
Last active October 4, 2016 13:45
LinkedList implemenation in Javascript
var LinkedList = function()
{
this._head = this._tail = null;
this._transverse = null;
this._size = 0;
}
function QEntry(prev, obj, next)
{
if (typeof obj === 'undefined' || obj === null) {
@staltz
staltz / introrx.md
Last active October 26, 2025 03:06
The introduction to Reactive Programming you've been missing
@nicebarbarian
nicebarbarian / spring-collection
Created October 15, 2014 15:45
framer.js: spring collection
exessiveSpring = "spring(200, 15, -3)"
gentleSpring = "spring(40, 5, 0)"
swingSpring = "spring(120, 15, 0)"
smoothSpring = "spring(100, 20, 0)"
superSlowSpring = "spring(30, 20, 0)"
slowSpring = "spring(100, 15, -3)"
snapSpring = "spring(200, 20, 0)"
tightSpring = "spring(300, 25, 0)"
straightSpring = "spring(500, 40, 0)"
@WebReflection
WebReflection / String.prototype.template.js
Last active August 17, 2022 04:04
ES6 Template like strings in ES3 compatible syntax.
// this is now a module:
// https://github.com/WebReflection/backtick-template#es2015-backticks-for-es3-engines--
var template = require('backtick-template');
// just string
const info = 'template';
`some ${info}` === template('some ${info}', {info});
@leodutra
leodutra / bitwise-hacks.js
Last active September 21, 2025 01:23
Fast Int Math + Bitwise Hacks For JavaScript
/**
* Bitwise Mathematics Utilities
*
* A collection of fast bitwise operations for integer mathematics.
* These functions prioritize performance over readability and should be used
* when micro-optimizations are critical (game engines, real-time applications).
*
* References:
* - http://michalbe.blogspot.com.br/2013/03/javascript-less-known-parts-bitwise.html
* - http://jsperf.com/bitwise-vs-math-object
@ericelliott
ericelliott / essential-javascript-links.md
Last active June 14, 2025 18:43
Essential JavaScript Links
@bendc
bendc / functional-utils.js
Last active July 15, 2025 04:33
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)