Skip to content

Instantly share code, notes, and snippets.

Avatar

Andy Brudtkuhl abrudtkuhl

View GitHub Profile
@vongillern
vongillern / gist:5dddaa6a636ceeb177e8
Created Jan 8, 2015
Javascript convert UTC date to a different timezone using moment.timezone.js and d3.js
View gist:5dddaa6a636ceeb177e8
var dateFormat = d3.time.format("%m/%d/%Y %H:%M:%S");
function dateConversion(utcTimestamp) {
//it took me nearly an entire day to write this one stupid line of code because js dates => teh suck
//the date from the file comes in as UTC (below)
//UTC: 1/7/2015 10:49:07 PM
//these are the equivilient
//America/Chicago: 1/7/2015 4:49:07 PM
@rayrutjes
rayrutjes / ais-wp.css
Created Jul 7, 2016
Some boilerplate to create an instantsearch.js search experience in your WordPress theme. This works in combination with the Algolia Search plugin for WordPress.
View ais-wp.css
#ais-wrapper {
display: flex;
}
#ais-main {
padding: 1rem;
width: 100%;
}
@karmi
karmi / nginx-elasticsearch-proxy.conf
Created May 23, 2011
Route requests to ElasticSearch to authenticated user's own index with an Nginx reverse-proxy
View nginx-elasticsearch-proxy.conf
# Run me with:
#
# $ nginx -p /path/to/this/file/ -c nginx.conf
#
# All requests are then routed to authenticated user's index, so
#
# GET http://user:password@localhost:8080/_search?q=*
#
# is rewritten to:
#
@artero
artero / launch_sublime_from_terminal.markdown
Last active Sep 11, 2020 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal
View launch_sublime_from_terminal.markdown

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@jlong
jlong / uri.js
Created Apr 20, 2012
URI Parsing with Javascript
View uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@ndarville
ndarville / business-models.md
Last active Oct 22, 2020
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.
View business-models.md

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
You can’t perform that action at this time.