Skip to content

Instantly share code, notes, and snippets.

View mjhea0's full-sized avatar

Michael Herman mjhea0

View GitHub Profile
@mjhea0
mjhea0 / hash_ex.rb
Last active December 16, 2015 22:59 — forked from nastysloper/hash_ex.rb
learn ruby the hard way
cities = {'CA' => 'San Francisco', 'MI' => 'Detroit', 'FL' => 'Jacksonville'}
cities['NY'] = 'New York'
cities['OR'] = 'Portland'
def find_city(map, state)
if map.include? state
return map[state]
else
return "Not found."

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+X delete line
Ctrl+↩ insert line after
Ctrl+⇧+↩ insert line before
Ctrl+⇧+↑ move line (or selection) up
#!/usr/bin/env python
from __future__ import with_statement # needed for python 2.5
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib import files
USAGE = """
================================================================
NOTE:
using this fabfile expects that you have the python utility
"""
License: MIT
Author: Heath Matlock
Problem: https://en.wikipedia.org/wiki/Weasel_program
"""
import string
import random
from time import time
@mjhea0
mjhea0 / README.md
Created October 28, 2013 17:23 — forked from mdirienzo/README.md

Progress Bar Widget

Description

A widget made for Dashing. This widget shows multiple animated progress bars and reacts dynamically to new information being passed in. Anything with a current state and with a projected max/goal state can easily be represented with this widget. Some sample ideas would be to show progress, completion, capacity, load, fundraising, and much more.

Features

  • Animating progress bars - Both the number and bar will grow or shrink based on new data that is being passed to it.
  • Responsive Design - Allows the widget to be resized to any height or width and still fit appropriately. The progress bars will split up all available space amongst each other, squeezing in when additional progress bars fill the widget.
var count = db.collections.count()
var rand = function(){return Math.floor( Math.random() * count )}
db.collection.find().limit(-1).skip(rand()).next();
These links:
http://help.nitrous.io/heroku/ and
http://help.nitrous.io/heroku-rails/
are good, but they're missing some information for deploying simple apps to Heroku.
This assumes that you already have Git and GitHub set up on Nitrous.io and you've been
pushing your code to GitHub throughout development.
-Do the first five steps of this page: http://help.nitrous.io/heroku/. Skip the rest
of the steps.
# This Python file uses the following encoding: utf-8
import json
from types import NoneType
def type_to_string(typ):
"""Return a custom Type name for python Type
:param typ: The python Type
:type typ: type.
:raises: TypeError
var http = require('http'),
httpProxy = require('http-proxy');
//
// A simple round-robin load balancing strategy.
//
// First, list the servers you want to use in your rotation.
//
var forwarding = {
"s.paddle.to" : {
target: "http://localhost:8001"