Skip to content

Instantly share code, notes, and snippets.

background-image: linear-gradient(40deg, rgba(252, 0, 0, 0.1225) 0%, rgba(211, 184, 76, 0.1225) 47%, rgba(107, 199, 218, 1) 100%);
@djcommandline
djcommandline / gist:620e3150115b3dfa1d0a
Created October 4, 2014 17:39
Simple HTTP server is python on Mac
# Start an HTTP server from a directory, optionally specifying the port
function server() {
local port="${1:-8000}";
sleep 1 && open "http://localhost:${port}/" &
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port";
}
(function() {
'use strict';
// this function is strict...
}());
module.exports = function(grunt) {
// AUTO TASK LOADER + EXECUTION TIME LOG
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
[
// Move OPen File to Window Group
{
"keys": ["super+alt+up"],
"command": "set_layout",
"args":
{
"cols": [0.0, 1.0],
"rows": [0.0, 1.0],
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.

#Node - Running in Production This gist is based on the excellent post by @hacksparrow which is found at http://www.hacksparrow.com/running-express-js-in-production-mode.html. The main principle is that you want the application to detect that it is running on a production server and to use the production configuration. The way to do this is to set the NODE_ENV=production. To do this you need to do the following:

$ export NODE_ENV=production

But we have a little problem here. The NODE_ENV environment variable will be lost if the server restarts, so it is safer to put it in the .bash_profile file. That way the variable will set again every time the system reboots. You will find the file in your home directory. It's a hidden file, so you can't see it unless you do a ls -la. We will append the export command to the .bash_profile file.

@ref http://blog.daanraman.com/coding/automatically-reload-chrome-when-editing-files-on-osx/
tell application "Google Chrome"
reload active tab of window 1
end tell
fswatch /Users/you/Sites/project "osascript reloadActiveChromeTab.applescript"
@djcommandline
djcommandline / SUBLIME :: KEYMAP
Created August 28, 2013 18:54
SUBLIME :: KEYMAP
[
// Move OPen File to Window Group
{
"keys": ["super+alt+up"],
"command": "set_layout",
"args":
{
"cols": [0.0, 1.0],
"rows": [0.0, 1.0],
@djcommandline
djcommandline / FETCH :: SUBLIME :: USERKEYS
Created July 17, 2013 21:52
FETCH :: SUBLIME :: USERKEYS
[
// Move OPen File to Window Group
{
"keys": ["super+alt+up"],
"command": "set_layout",
"args":
{
"cols": [0.0, 1.0],
"rows": [0.0, 1.0],
@djcommandline
djcommandline / LIST :: TOOLS
Created July 10, 2013 18:16
LIST :: TOOLS
toolbox sites
http://thetoolbox.cc/
http://www.agiledesigners.com/
record terminal window and share
http://ascii.io
chart of screen sizes
http://screensiz.es/phone