Skip to content

Instantly share code, notes, and snippets.

# Terminal Cheat Sheet
pwd # print working directory
ls # list files in directory
cd # change directory
~ # home directory
.. # up one directory
- # previous working directory
help # get help
-h # get help
/**
*
* Name v0.0.1
* Description, by Chris Ferdinandi.
* http://gomakethings.com
*
* Free to use under the MIT License.
* http://gomakethings.com/mit/
*
*/
@stewartduffy
stewartduffy / gist:f6b774deeb8ed735db29
Created February 26, 2015 21:32
JS function to get file name (without path or file extention)
var fileName = function(filePath) {
var filename = filePath.split("/");
return filename[filename.length - 1].replace(/\.[^/.]+$/, "");
};
var filePath = "/downloads/tm/logos/IMG_30012014_185815.png";
console.log( fileName(filePath) );
@stewartduffy
stewartduffy / gist:6bd7fad208bf98043966
Last active August 29, 2015 14:16
JS get calculate GST
var calculateGst = function(price, taxRate) {
return (price * (taxRate * 100) / 100).toFixed(2);
};
var addGst = function(price, taxRate) {
return (price * 1 + ( price * (taxRate * 100) / 100 )).toFixed(2);
};
@stewartduffy
stewartduffy / gist:1481230253d6fbc366df
Created March 3, 2015 22:57
Create GUID / UUID in JavaScript
function guid() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
}
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Danish Royalty/Danish Royalty.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "load/save",
"linters": {
"htmltidy": {
@stewartduffy
stewartduffy / .htaccess
Last active August 29, 2015 14:20 — forked from jxnblk/.htaccess
Options +FollowSymLinks
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index.html [L]
</ifModule>
@stewartduffy
stewartduffy / index.html
Created December 2, 2012 21:15
A CodePen by Stewart Duffy.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Bad way...</title>
</head>
<body>
<div class='tall'>
<div class='short'>
Foo bar baz
</div>
/**
* Sample time
*/
background: #f06;
background: linear-gradient(90deg, #f06, yellow);
min-height: 100%;
font-family: Rockwell, "Courier Bold", Courier, Georgia, Times, "Times New Roman", serif;
@stewartduffy
stewartduffy / wp_upload_limit.php
Created May 14, 2013 09:26
Chuck this in your .htaccess file to Increase upload limit in wordpress with .htaccess file
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300