Skip to content

Instantly share code, notes, and snippets.

@ngmaloney
ngmaloney / get_meta_description.js
Created June 27, 2011 21:07
A Javascript function used to extract meta description from an HTML document.
/**
* Returns document meta description
*/
getMetaDescription = function() {
var metas = document.getElementsByTagName('meta');
for(var i in metas) {
if (typeof(metas[i].name) != 'undefined' && metas[i].name.toLowerCase() == "description") {
return encodeURIComponent(metas[i].content);
}
}
@gre
gre / easing.js
Last active May 8, 2024 14:30
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@xurizaemon
xurizaemon / dynamic-variable-names.scss
Created September 19, 2012 22:56
i wanted dynamic variable names in sass. it doesn't do everything i expected. sadface panda needs to get hacking.
$whatson: #ed8f25;
$whatsonBg: lighten($whatson, 20%);
$childcare: #7c398a;
$childcareBg: lighten($childcare, 40%);
$health: #9cc700;
$healthBg: lighten($health, 30%);
$shopping: #0065fd;
$shoppingBg: lighten($shopping, 30%);
$groups: #cb0033;
$groupsBg: lighten($groups, 50%);
@rab
rab / .gitconfig
Last active April 1, 2024 20:51
A good starting point for ~/.gitconfig
# -*- Conf -*-
[color]
branch = auto
diff = auto
status = auto
showbranch = auto
ui = true
# color.branch
# A boolean to enable/disable color in the output of git-branch(1). May be set to always, false (or
@19h
19h / reset.js
Created February 19, 2013 22:51
Node.js — Clear Terminal / Console. Reset to initial state.
console.reset = function () {
return process.stdout.write('\033c');
}
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 7, 2024 01:27
A badass list of frontend development resources I collected over time.
@c0bra
c0bra / gist:5859295
Created June 25, 2013 15:15
ngVisible angular directive
.directive('ngVisible', function () {
return function (scope, element, attr) {
scope.$watch(attr.ngVisible, function (visible) {
element.css('visibility', visible ? 'visible' : 'hidden');
});
};
})
@ahmedelgabri
ahmedelgabri / Sublime Text command log
Created September 21, 2013 19:19
Log Sublime Text command in the console, very helpful when trying to figure out command you want to create shortcuts for.
sublime.log_commands(True)
@danfinlay
danfinlay / How to download streaming video.md
Last active March 23, 2024 03:32
How to download a streaming video with Google Chrome

How to download streaming video

Streaming just means a download that they don't want you to keep. But Chrome's developer tools make it easy to access what's really going on under the hood.

Open Developer Tools

From the page where you want to download some things, go into your chrome menu to open the developer tools. You can either:

1.  (On a mac): Command-option-J
2. (On a PC): Control-alt-J
@kerimdzhanov
kerimdzhanov / random.js
Last active April 20, 2024 03:21
JavaScript: get a random number from a specific range
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {number} a random floating point number
*/
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}