Skip to content

Instantly share code, notes, and snippets.

@bavey
bavey / python-server.txt
Created July 12, 2013 20:37
Spin up local Python server
python -m SimpleHTTPServer
@bavey
bavey / server.js
Created July 20, 2013 16:49
Setup a simple Node.js server
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
response.end('<html><body>' + request.url + '</body></html>');
console.log(request.url);
}).listen(3000, 'localhost');
@bavey
bavey / index.html
Created July 20, 2013 21:57
A CodePen by David DeSandro. Loader dots - Lamer version of http://codepen.io/jshawl/pen/IFxBK
<div class="loader">
<div class="dot dot1"></div>
<div class="dot dot2"></div>
<div class="dot dot3"></div>
<div class="dot dot4"></div>
</div>
@bavey
bavey / json-stringify
Created July 23, 2013 20:32
Stringify JSON object.
var testObject = { 'one': 1, 'two': 2, 'three': 3 };
// Put the object into storage
localStorage.setItem('testObject', JSON.stringify(testObject));
console.log(JSON.stringify(testObject));
// Retrieve the object from storage
var retrievedObject = localStorage.getItem('testObject');
@bavey
bavey / svn-list-last-tag
Created August 1, 2013 01:27
SVN: list last tag
svn ls http://example.com/svn/example/tags/qa | cut -d "/" -f 1 | sort -t . -k 1,2n -k 2,2n -k 3,2 | tail –n1
@bavey
bavey / common-mysql-cli-commands.md
Last active May 26, 2020 02:28
Common MySQL CLI Commands

Common MySQL CLI Commands

The following commands are organized by their CRUD functionality. This was designed to be a quick 'n easy cheat sheet.

Sample Data

Database: savetheworld
Table: superheros

id superhero password email age
1 batman badpassword batman@superhero.com 40
@bavey
bavey / Preferences.sublime-settings
Last active December 27, 2015 14:28
My Sublime User Preference Settings
{
"caret_style": "smooth",
"close_windows_when_empty": true,
"create_window_at_startup": false,
"font_size": 14,
"highlight_line": true,
"hot_exit": false,
"ignored_packages":
[
"Vintage"
@bavey
bavey / gist:8329558
Last active January 2, 2016 16:19
How to use a jQuery Plugin with RequireJS

##How to use a jQuery Plugin with RequireJS

I'm using several jQuery Plugins for a Node app I'm building. One plugin in particular which I'll use for illustration purposes is jQuery Cookie. jQuery Cookie depends on jQuery, therefore I needed an ascyhonous dependency management solution.

After searching throug RequireJS documentation and trial and error, I was able to put together the following working code to serve as a shim. This code resides in a a file called common.js and sits at the root of my /javascripts directory (where all of my other RequireJS modules camp out as well.) In this file I define two resources. In this case I'm pointing to CDN versions of jQuery and jQuery Cookie (this actually further exaserbates the need for a dependency management system as I'm not loading these resources from my own server and can't control latency and network delays.)

common.js

require.config({

paths: {

@bavey
bavey / gist:8713170
Last active April 8, 2019 08:27
Resolving Heroku/Git push deployment errors.

This is how to resolve the following command line error message when pushing your app to Heroku:

~/Desktop/appname git push heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
fatal: 'heroku' does not appear to be a git repository
Please make sure you have the correct access rights and the repository exists.

The above error message appears because there's no remote named heroku. When you do a heroku create, if the git remote doesn't already exist, Heroku automatically creates one assuming you're in a git repo.

@bavey
bavey / gommongitcommands.md
Last active August 29, 2015 13:57
Common Git Commands

Common Git Commands

Configure file locations

  • System
    • /etc/gitconfig
    • Program Files\Git\etc\gitconfig
  • User
    • ~/.gitconfig
    • $HOME\.gitconfig
  • Project