Skip to content

Instantly share code, notes, and snippets.

View nverba's full-sized avatar
🏠
Working from home... Forever

Michael nverba

🏠
Working from home... Forever
View GitHub Profile
@import url(https://fonts.googleapis.com/css?family=Fira+Mono|Fira+Sans:400,700);
html{
font:18px/1.5 'Fira Sans', sans-serif;
color:rgb(55,71,79);
}
body{
background:#fefefe;
font:1rem;
margin:2rem 1rem;
alias c='clear; printf %"$COLUMNS"s |tr " " "-"'
alias s="c; git status"
alias d="c; git diff --color"
alias r="reset"
alias p="c; git push"
alias l="c; git pull"
alias g="c; git commit -m 'Generic commit *to be squashed'"
alias x="c; git commit -am 'Generic commit *to be squashed'"
if [ -f $(brew --prefix)/etc/bash_completion ]; then
@nverba
nverba / n.sh
Last active January 8, 2018 10:22
No sudo install of n & iojs with NPM
#!/bin/bash
# prerequisites, the terminal should be able to "Run command as login shell", see profile/title & commands
# Create .local/bin
mkdir -p ~/.local/bin
# Add local/bin to path & add environment variable N_PREFIX
printf '\nexport PATH=$PATH:$HOME/.local/bin' >> $HOME/.bash_profile
@nverba
nverba / basic.html
Created December 18, 2013 11:36
angular-pikaday examples
<input pikaday="myPicker1"></input>
<span>{{ myPicker1.getDate() | date:'MM/dd/yyyy' }}</span>
@nverba
nverba / index.html
Created April 19, 2013 19:59
test image generation
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#img_div {
width:450px;
height:300px;
border: 1px solid blue;
}
@nverba
nverba / index.html
Last active July 2, 2022 21:25
Testing d3.js and image downloading
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#img_div {
width:450px;
height:300px;
border: 1px solid blue;
}
@nverba
nverba / index.html
Last active December 16, 2015 09:18 — forked from battlehorse/index.html
<html>
<head>
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/rgbcolor.js"></script>
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/canvg.js"></script>
<script>
function getImgData(chartContainer) {
var chartArea = chartContainer.getElementsByTagName('svg')[0].parentNode;
var svg = chartArea.innerHTML;
var doc = chartContainer.ownerDocument;
var canvas = doc.createElement('canvas');
@nverba
nverba / HEROKU-EXPERIMENTAL.md
Last active December 14, 2015 16:38
Experimental deployment of Discourse for Heroku. Work in progress.

Basic Heroku deployment - experimental

Update 4 files to be able to parse config/redis.yml with ERB.

config/initializers/message_bus.rb

- MessageBus.redis_config = YAML::load(File.open("#{Rails.root}/config/redis.yml"))[Rails.env].symbolize_keys

+ MessageBus.redis_config = YAML.load(ERB.new(File.new("#{Rails.root}/config/redis.yml").read).result)[Rails.env].symbolize_keys
@nverba
nverba / partials.rb
Created February 10, 2012 16:57 — forked from lenary/partials.rb
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
# and made a lot more robust by me
# this implementation uses erb by default. if you want to use any other template mechanism
# then replace `erb` on line 13 and line 17 with `haml` or whatever
module Sinatra::Partials
def partial(template, *args)
template_array = template.to_s.split('/')
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
options = args.last.is_a?(Hash) ? args.pop : {}
options.merge!(:layout => false)
@nverba
nverba / scale.rake
Created January 16, 2012 23:18 — forked from samsm/scale.rake
"Auto" Scale Heroku Cedar instances with rake tasks
I think this is a nice option for apps that are mostly used during particular hours and aren't really ready
for a more intense auto-scaling thing. Hirefire (https://github.com/meskyanichi/hirefire) likely does a
lot more, but I didn't really understand how it worked and don't really need something that fancy right now.
I suspect it requires at least one worker itself, but I don't really know.
Add an API key to your app's Heroku config
heroku config:add HEROKU_API_KEY=your_key (from https://api.heroku.com/account )
Add the above rake task.