Skip to content

Instantly share code, notes, and snippets.

@polotek
polotek / pipeaccept.js
Created May 18, 2011 01:16 — forked from heapwolf/pipeaccept.js
accepting input from a pipe, nodejs
var data;
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
data += chunk;
});
process.stdin.on('end', function() {
@mhawksey
mhawksey / gist:1276293
Last active October 23, 2023 09:00
Google App Script to insert data to a google spreadsheet via POST or GET - updated version as per https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@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
}
@daveaugustine
daveaugustine / Inside_your_router.coffee
Created February 8, 2012 18:33
Super simple Google Analytics page tracking with backbone
initialize: ->
@bind 'all', @_trackPageview
_trackPageview: ->
url = Backbone.history.getFragment()
_gaq.push(['_trackPageview', "/#{url}"])
@leemeichin
leemeichin / README.md
Created April 12, 2012 12:02
Modulo Liquid filter for Jekyll

Modulo Liquid filter for Jekyll

Got nested columns in your grid-based Jekyll site?

Wondered why you didn't have a way to calculate the modulo inside your posts loop to open and close your 'rows' containing those nested columns?

Add this filter to your _plugins directory, and use it like so:

{{ x | mod:y }}
@tim-steele
tim-steele / wp-config.php
Created July 2, 2012 21:25 — forked from eddiemoya/wp-config.php
WordPress - wp-config.php settings for dynamic host detection.
define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wp-content' );
define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins' );
define( 'PLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins' );
define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content');
define( 'WP_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content/plugins');
define( 'UPLOADS', 'wp-content/uploads' );
@rclark
rclark / L.TopoJSON.js
Last active December 7, 2022 00:23
TopoJSON-aware Leaflet layer
/*
You'll need something like this in your HTML:
<script src="http://d3js.org/topojson.v1.min.js"></script>
*/
L.TopoJSON = L.GeoJSON.extend({
addData: function(jsonData) {
if (jsonData.type === "Topology") {
for (key in jsonData.objects) {
geojson = topojson.feature(jsonData, jsonData.objects[key]);
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active April 23, 2024 12:01
5 entertaining things you can find with the GitHub Search API
@natritmeyer
natritmeyer / debug_httparty_request.rb
Last active November 8, 2023 15:47
How to debug HTTParty requests
class MyResource
include HTTParty
debug_output $stdout # <= will spit out all request details to the console
#...
end
@oeon
oeon / pgRouting_intro.md
Last active February 27, 2022 09:44
basic steps with pgRouting to make alpha shape of isochrone
  1. createdb with postgres > create postgis/pgrouting extension > load road data with ogr2ogr or shp2pgsql or SPIT in QGIS

  2. create vertices_tmp table with id/geom columns

select pgr_createTopology('roads', 0.5, 'geom', 'id');

  1. from 29788 = to the nearest 'vertices_tmp' node id to Station 15, select #all nodes less than 10 units (minutes) of cost
SELECT id, id1 AS node, id2 AS edge, cost, the_geom
INTO "20_10min_nodes"