Skip to content

Instantly share code, notes, and snippets.

View phocks's full-sized avatar
🦖
"Rrrrrraaaawwwwwr!!" —A dinosaur

Joshua Byrd phocks

🦖
"Rrrrrraaaawwwwwr!!" —A dinosaur
View GitHub Profile
@joemccann
joemccann / nginx + node setup.md
Created October 25, 2010 02:06
Set up nginx as a reverse proxy to node.js.

The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).

In a nutshell,

  1. nginx is used to serve static files (css, js, images, etc.)
  2. node serves all the "dynamic" stuff.

So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.

  1. nginx listens on port 80.
@stympy
stympy / generate_archives.rb
Created May 23, 2011 13:05
Archive generator plugin for jekyll
# Jekyll archive page generator with pagination.
#
# Based on the category generator from
# http://recursive-design.com/projects/jekyll-plugins/,
# which is copyright (c) 2010 Dave Perrett,
# http://recursive-design.com/ and is licensed under the MIT
# license (http://www.opensource.org/licenses/mit-license.php), and
# on the pagination code from Jekyll itself.
#
# This code is copyright (c) 2011 Benjamin Curtis, and is licensed
@bentruyman
bentruyman / slug.js
Created September 12, 2011 14:31
JavaScript Slug Generator
// Generates a URL-friendly "slug" from a provided string.
// For example: "This Is Great!!!" transforms into "this-is-great"
function generateSlug (value) {
// 1) convert to lowercase
// 2) remove dashes and pluses
// 3) replace spaces with dashes
// 4) remove everything but alphanumeric characters and dashes
return value.toLowerCase().replace(/-+/g, '').replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
};
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@gre
gre / easing.js
Last active May 17, 2024 03:33
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 = {
@mbostock
mbostock / .block
Last active May 8, 2024 16:54 — forked from mbostock/.block
Choropleth
license: gpl-3.0
height: 600
border: no
redirect: https://beta.observablehq.com/@mbostock/d3-choropleth
@dwtkns
dwtkns / README.md
Last active March 28, 2023 23:31
Faux-3D Arcs

Building on this - experimenting with fake 3d svg arcs using two nested orthographic projections and cardinal line interpolation.

@randomecho
randomecho / australian-postcodes.sql
Last active May 11, 2024 07:46
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
@M1ke
M1ke / turn-off-retweets
Last active March 7, 2018 23:22
Want to turn off Retweets from all users you're following without clicking each time? This script sorts that, using a timer to avoid your requests being blocked and returning a 403. Scroll to the bottom of your Following list, paste it into Chrome's console (Firefox should work too) and hit enter. It turns off 3 per minute (you could reduce the …
var interval=setInterval(function(){
$('.user-actions.including .retweet-off-text').last().click();
if ($('.user-actions.including .retweet-off-text').length<1) {
clearInterval(interval);
}
},20000);
@ifamily
ifamily / Clear fix for Genesis Column Classes
Last active April 1, 2018 20:40
This CSS will fix problems caused by Genesis Column Classes of uneven height. Just add a div with the class name of clear-line to your code. Then add this to your .css file.
/*
Clear fix for column classes
---------------------------------------------------------------------------------------------------- */
.clear-line:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;