Skip to content

Instantly share code, notes, and snippets.

@addyosmani
addyosmani / example.js
Created February 11, 2012 01:02
Mediator pattern
// Example 1
mediator.name = 'Doug';
mediator.subscribe('nameChange', function(arg){
console.log(this.name);
this.name = arg;
console.log(this.name);
});
mediator.publish('nameChange', 'Jorn');
@joshcarr
joshcarr / soundwaves.js
Created May 1, 2014 23:16
Creating sound waves with JavaScript
// Creating sound waves with JavaScript
// from http://js.do/blog/sound-waves-with-javascript/
var samples = []
//
//
//
// Achord
@himynameisdave
himynameisdave / gradient-animation.less
Last active May 23, 2023 01:45
Mixins for Animating Between Gradients
.gradient-animation( @start, @end, @transTime ){
background-size: 100%;
background-image: linear-gradient(@start, @end);
position: relative;
z-index: 100;
&:before {
background-image: linear-gradient(@end, @start);
content: '';
display: block;
height: 100%;
@mklabs
mklabs / bootstrap-plugins.txt
Created December 2, 2011 11:23
h5bp + twitter bootstrap integration
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-alert.js
bootstrap-button.js
bootstrap-carousel.js
bootstrap-collapse.js
bootstrap-dropdown.js
bootstrap-modal.js
bootstrap-scrollspy.js
bootstrap-tab.js
@pjobson
pjobson / MKVToolNix_notes.md
Last active January 31, 2023 13:06
Notes for creating, editing, and extracting MKV files.

MKVToolNix Notes

Various notes for using MKVToolNix.

Probe a Video

mkvinfo lists all elements contained in an MKV container file.

mkvinfo container.mkv
@cms
cms / getStyle.js
Created April 17, 2010 00:48
Get computed styles
function getStyle(el, styleProp) {
var value, defaultView = el.ownerDocument.defaultView;
// W3C standard way:
if (defaultView && defaultView.getComputedStyle) {
// sanitize property name to css notation (hypen separated words eg. font-Size)
styleProp = styleProp.replace(/([A-Z])/g, "-$1").toLowerCase();
return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
} else if (el.currentStyle) { // IE
// sanitize property name to camelCase
styleProp = styleProp.replace(/\-(\w)/g, function(str, letter) {
@rbanffy
rbanffy / gist:9c806ba406dba9a5afa324d0be3b8f13
Last active November 19, 2021 20:08
Find out more about your CPU
open http://www.google.com/?q=$(sysctl -n machdep.cpu.brand_string | awk '{FS=" " ; print $2 "+" $3 "+" $4}')+site:ark.intel.com
or, on a Linux machine
xdg-open http://www.google.com/?q=$(fgrep 'model name' /proc/cpuinfo | head -n 1 | awk '{FS=" " ; print $5 "+" $6}')+site:ark.intel.com
@lambdalisue
lambdalisue / install_gui_application_darwin.sh
Created November 13, 2014 17:35
Install Mac OS X Gui Application via Homebrew Cask
#!/usr/bin/env bash
#==============================================================================
# Install Mac OS X GUI Application via brew cask
#==============================================================================
brew cask install google-chrome
brew cask install thunderbird
brew cask install dropbox
brew cask install copy
brew cask install slack
brew cask install the-unarchiver
@eek
eek / slugify.js
Last active August 4, 2021 14:23
Vanilla JavaScript Slugify + Accent removal - Just another JavaScript Slugifier with an extra line for Accent Removal
function slugify(text) {
return text.toString().toLowerCase().trim()
.normalize('NFD') // separate accent from letter
.replace(/[\u0300-\u036f]/g, '') // remove all separated accents
.replace(/\s+/g, '-') // replace spaces with -
.replace(/&/g, '-and-') // replace & with 'and'
.replace(/[^\w\-]+/g, '') // remove all non-word chars
.replace(/--+/g, '-') // replace multiple '-' with single '-'
}
@maddy2101
maddy2101 / gist:5668835
Last active March 12, 2021 12:08
TCA, Model and Fluid Partial to display FAL images as a simple gallery using TYPO3 and Extbase 6.1
SQL:
images int(11) unsigned DEFAULT '0',
=======================================================
TCA
....
'images' => array(
'exclude' => 0,
'label' => 'images',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'images',