Skip to content

Instantly share code, notes, and snippets.

View logikinc's full-sized avatar
💭
I may be slow to respond.

LogikIO logikinc

💭
I may be slow to respond.
View GitHub Profile
# Add correct content-type for fonts
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType font/x-woff .woff
AddType image/svg+xml .svg
# Compress compressible fonts
AddOutputFilterByType DEFLATE font/ttf font/otf image/svg+xml
@pbapi
pbapi / peoplebrowsr-positive-influencers-api.py
Created December 6, 2011 22:59
PeopleBrowsr - Positive Influencers API
import urllib2
app_id = "[app_id]"
app_key = "[app_key]"
last = "yesterday"
count = "30"
source = "twitter"
term = "Pepsi"
number = "10"
@giltotherescue
giltotherescue / percent-change.php
Created February 24, 2012 15:19
Calculate Percentage Change
<?
/**
Calculates the percentage change between two numbers.
Useful for showing how much traffic has changed from one time period to the next.
*/
$percentChange = function ($cur, $prev) {
@leommoore
leommoore / nginx_basics.md
Last active May 27, 2024 09:17
Nginx Basics

#Nginx Basics for Ubuntu

Please see http://wiki.nginx.org/Main for more information. See http://arstechnica.com/gadgets/2012/11/how-to-set-up-a-safe-and-secure-web-server/ for a tutorial on how to install Nginx.

##Installation To install, you can install the version which is in the standard Ubuntu repositories but it is normally quite old and will not have the latest security patches. The best way is to update the repositories first:

apt-get update
apt-get install python-software-properties

apt-get upgrade

@sergeifilippov
sergeifilippov / domain-nginx.conf
Created February 10, 2014 03:22
linux-dash with nginx
server {
server_name $domain_name;
root /var/www;
index index.html index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Cache static files for as long as possible
location ~* \.(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ {
try_files $uri =404;
@LeCoupa
LeCoupa / casperjs.cheatsheet.js
Last active January 23, 2022 07:56
Cheatsheet: CasperJS, PhantomJS & Spooky --> https://github.com/LeCoupa/awesome-cheatsheets
// PhantomJS Cheatsheet
$ brew update && brew install phantomjs // install PhantomJS with brew
phantom.exit();
var page = require('webpage').create();
page.open('http://example.com', function() {});
page.evaluate(function() { return document.title; });
@felthy
felthy / routes.php
Created June 4, 2014 00:23
Use laravel-cachebuster in conjunction with Laravel's built-in PHP development web server. A slightly modified version of code by @RTC1
if (App::runningUnitTests() && is_development_server()) {
/**
* CACHE BUSTERS
*/
Route::pattern('hash', '[a-zA-Z0-9]+');
Route::pattern('allowedExtensions', '(jpg|png|gif|js|css|woff|ttf|svg|eot){1}');
Route::pattern('folders', '[a-zA-Z0-9_\/]*');
Route::pattern('fileName', '.+');
$guesser = \Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser::getInstance();
@RTC1
RTC1 / gist:89d7f95555be8cf7d1aa
Created June 27, 2014 15:14
CacheBuster NGINX Rule 1
location ~* "^(.+)-[0-9a-f]{32}(\.(.*))$" {
try_files $uri $1$2 =404;
}
@joshuabaker
joshuabaker / html.js
Created July 23, 2014 15:31
Sample script to load a script asynchronously whilst queuing method calls. Inspired by the Google Analytics tracking code.
// Placed into HTML
(function(window, document, tag, src, property, script, before)
{
window['LoaderObject'] = property;
window[property] = window[property] || function()
{
(window[property].q = window[property].q || []).push(arguments);
}
@brock
brock / nodereinstall.sh
Last active June 13, 2024 12:20
Complete Node Reinstall. I've moved this to a repo at http://git.io/node-reinstall
#!/bin/bash
# node-reinstall
# credit: http://stackoverflow.com/a/11178106/2083544
## program version
VERSION="0.0.13"
## path prefix
PREFIX="${PREFIX:-/usr/local}"