Skip to content

Instantly share code, notes, and snippets.

View danielgamage's full-sized avatar
💿
lmao

Daniel Gamage danielgamage

💿
lmao
View GitHub Profile
@danielgamage
danielgamage / header-transition.js
Last active July 5, 2016 00:53
fade a background color on header over course of scrolling with jQuery
var scroller = function() {
var scrollPosition = $(window).scrollTop();
if ( scrollPosition < 90 ) {
var bgColor = 'rgba(0, 0, 0, ' + (scrollPosition / 100) + ')';
$('.navbar').css('background-color', bgColor);
} else {
$('.navbar').css('background-color', 'rgba(0, 0, 0, 0.9)');
}
}
@danielgamage
danielgamage / functions.php
Created December 22, 2014 21:25
Add categories to media (attachments) in wordpress
...
add_action( 'init', 'create_media_category' );
function create_media_category() {
register_taxonomy(
'media_category', // taxonomy machine name
'attachment', // content type
array(
'labels' => array(
@danielgamage
danielgamage / .csscomb.json
Created November 24, 2014 22:23
csscomb configuration
{
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "lower",
"block-indent": "\t",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": true,
"leading-zero": true,
"quotes": "double",
@danielgamage
danielgamage / git-transfer.sh
Created August 21, 2014 13:44
switch remotes on a repository and push everything to new location
#!/bin/bash
git remote rm origin
git remote add origin $1
git push -u origin --all
@danielgamage
danielgamage / compress.sh
Created May 5, 2014 18:31
compress directory as a .tar.gz with shell script
#!/bin/sh
tar -cvzf /compress.tar.gz /directory-to-compress/