Skip to content

Instantly share code, notes, and snippets.

View bigandy's full-sized avatar

Andrew Hudson bigandy

View GitHub Profile
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@dux
dux / gist:1674131
Created January 25, 2012 01:55
Sass / Less / Coffee compiler - Ruby command line
#!/usr/bin/env ruby
# sudo gem install sass
# npm install less -g
# npm install coffee -g
p 'Dux sass/less/coffee compiler v0.1'
while true
sleep 1 if (@last_mtime ||=0) > 0
$.fn.setAllToMaxHeight = function(){
return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) );
}
// usage: $(‘div.unevenheights’).setAllToMaxHeight();
{
"folders":
[
{
"path": "/Users/andrew/Projects/inuit",
"folder_exclude_patterns": [".sass-cache"],
"file_exclude_patterns": [".*", "*.md", "watch", "LICENSE", "*.sublime-*", "*.txt"]
}
]
}
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active March 20, 2025 17:17
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@kethinov
kethinov / walksync.js
Created September 22, 2013 09:04
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@kerimdzhanov
kerimdzhanov / random.js
Last active June 3, 2025 16:04
JavaScript: get a random number from a specific range
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {number} a random floating point number
*/
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}
@vincentorback
vincentorback / debounce-es2015.js
Last active July 22, 2024 11:49
Smarter debouncing
export function debounce (fn, wait = 1) {
let timeout
return function (...args) {
clearTimeout(timeout)
timeout = setTimeout(() => fn.call(this, ...args), wait)
}
}
@bigandy
bigandy / Useful CLI Commands
Last active February 6, 2017 18:08
Useful CLI Commands
# Prevent need for sudo npm install ...
sudo chown -R `whoami` ~/.npm
# Allow updating of Themes, plugins, Core in WordPress
sudo chown -R andrew:_www <site>
# Copy file from one location to another
# in this case the wordpress template into the test folder
cp -R source/wp test
@Schniz
Schniz / plaintext-contenteditable.css
Last active April 8, 2022 17:46
Plain-Text ContentEditable div for React.js
.comPlainTextContentEditable {
-webkit-user-modify: read-write-plaintext-only;
}
.comPlainTextContentEditable--has-placeholder::before {
content: attr(placeholder);
opacity: 0.5;
color: inherit;
cursor: text;
}