Skip to content

Instantly share code, notes, and snippets.

View dangayle's full-sized avatar

Dan Gayle dangayle

View GitHub Profile
@dangayle
dangayle / sassvariablescope.scss
Created April 27, 2011 22:29
Override SASS variable scope?
$mid:#66CCFF;
$dark:darken($mid, 40%);
a{
color:$mid;
&:hover{color:dark;}
}
@media only screen and (max-width: 767px) {
$mid:#22CCFF;
@dangayle
dangayle / sasscolormixins.scss
Created April 27, 2011 22:57
sass color mixins?
$mid:#66CCFF;
@mixin colors($mid){
$lightest:lighten($mid, 50%);
$lighter:lighten($mid, 29%);
$light:lighten($mid, 25%);
$midder:darken($mid, 25%);
$dark:darken($mid, 40%);
$darkest:darken($mid, 60%);
$select:complement($dark);
@dangayle
dangayle / gist:1903175
Created February 24, 2012 19:33
Python Bottle SQLite Version
from bottle import route, run, install
from bottle_sqlite import SQLitePlugin
install(SQLitePlugin(dbfile='bottle.db'))
@route('/db/')
def database(db):
data = db.execute('SELECT SQLITE_VERSION()').fetchone()
print "SQLite version: %s" % data
@dangayle
dangayle / gist:2040573
Created March 15, 2012 00:06
jquery slider loop thing
//Originally from http://trendmedia.com/news/infinite-rotating-images-using-jquery-javascript/
var InfiniteRotator =
{
init: function()
{
//set values
var initialFadeIn = 1000;
var itemInterval = 3000;
var fadeTime = 2500;
@dangayle
dangayle / gist:2912166
Created June 11, 2012 19:33
NGINX + PHP-FPM
Tasks: 84 total, 6 running, 78 sleeping, 0 stopped, 0 zombie
Cpu(s): 93.5%us, 4.3%sy, 0.0%ni, 0.3%id, 0.0%wa, 0.0%hi, 0.9%si, 1.0%st
Mem: 506876k total, 316792k used, 190084k free, 42752k buffers
Swap: 262140k total, 7640k used, 254500k free, 185948k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
19506 www-data 20 0 65868 24m 16m R 78 5.0 0:09.23 php5-fpm
19507 www-data 20 0 65100 25m 17m R 78 5.1 0:08.96 php5-fpm
19509 www-data 20 0 65356 24m 16m R 75 4.9 0:04.06 php5-fpm
19510 www-data 20 0 65100 24m 16m R 75 4.9 0:04.15 php5-fpm
@dangayle
dangayle / nginx-mobile-redirect
Last active September 29, 2024 22:09
NGINX Mobile redirect
# Place this map directive inside the http block
http {
# Updated map directive with the latest regex
map $http_user_agent $mobile_agent {
default 0;
"~*android.+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|iphone|ipod|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino" 1;
"~*^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a\\ wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r\\ |s\\ )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1\\ u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp(\\ i|
@dangayle
dangayle / gist:4027080
Created November 6, 2012 19:55
Remove capital_P_dangit function from wordpress
<?php
//add to functions.php
remove_filter('the_content','capital_P_dangit');
remove_filter('the_title','capital_P_dangit');
remove_filter('comment_text','capital_P_dangit');
?>
@dangayle
dangayle / gist:4027095
Created November 6, 2012 19:58
Incorrect way to import RSS feeds
<?php
include_once(ABSPATH.WPINC.'/rss.php');
wp_rss('http://feeds.feedburner.com/wprecipes', 3);
?>
@dangayle
dangayle / gist:4027389
Created November 6, 2012 20:43
How to block your own IP from Awstats
Find this file:
/tmp/awstats/awstats.DOMAIN.conf
edit SkipHosts:
# Do not include access from clients that match following criteria.
# If your log file contains IP adresses in host field, you must put here
# matching IP adresses criteria.
# If DNS lookup is already done in your log file, you must put here hostname
# criteria.
@dangayle
dangayle / html.sublime-build
Created December 8, 2012 00:49
HTML Build Command for Sublime Text 2
{
"cmd": ["open", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.html"
}