Skip to content

Instantly share code, notes, and snippets.

View nicholaides's full-sized avatar

Mike Nicholaides nicholaides

View GitHub Profile
@nicholaides
nicholaides / sh_redirect.rb
Created February 25, 2018 18:59
Like FileUtils#sh but lets you specify a file to redirect output to. Helpful for building rake tasks.
# Like sh, but
# 1. lets you specify a file to redirect output to and
# 2. removes the file if there's an error
def sh_redirect(*args, out:)
sh(*args, { out: out }, {}) do |ok, status|
unless ok
rm_f out
raise "Command failed: `#{args.join(' ')}`\nDeleted `#{out}`"
end
end
@nicholaides
nicholaides / rake-prereqs-to-dot.rb
Created February 25, 2018 16:36
Visualize rake dependencies with Graphviz
# Usage: rake -P | ruby rake-prereqs-to-dot.rb | dot -Tpng | imgcat
require 'pp'
tasks = {}
dependencies = nil
ARGF.each_line.lazy.map(&:strip).each do |line|
if match = line.match(/^rake (.*)/)
dependencies = tasks[match[1]] ||= []
@nicholaides
nicholaides / osx-defaults.sh
Created September 12, 2014 02:13
OSX defaults
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@nicholaides
nicholaides / keybase.md
Created July 16, 2014 21:16
keybase.md

Keybase proof

I hereby claim:

  • I am nicholaides on github.
  • I am nicholaides (https://keybase.io/nicholaides) on keybase.
  • I have a public key whose fingerprint is 8144 058C 973F 358A D27D D84F 52DB F822 9A78 6E8B

To claim this, I am signing this object:

@nicholaides
nicholaides / job.md
Last active August 29, 2015 14:03
PromptWorks Senior Software Engineer job listing

PromptWorks is a burgeoning software consulting company based in Philadelphia, PA seeking a Senior Software Engineer.

About the position

Senior software engineer responsibilities include:

  • Writing quality software for and providing technical direction to our clients
  • Interfacing directly with our clients, gathering their needs and managing their expectations
  • Taking ownership of our work-product
  • Working well in a small team and independently when necessary
@nicholaides
nicholaides / sso plan.md
Last active August 29, 2015 14:00
SSO Plan

Tasks:

  • Create a proxy ala sorcery that will:
  • Omniauth config:
    • point to the made-up-endpoint
@nicholaides
nicholaides / configuration_with.rb
Last active August 29, 2015 13:59
Configuration comparison
require 'attributes'
module StackerBee
class Configuration
include Attributes
attribute :ssl_verify?, default: proc { true }
attribute :url
attribute :secret_key
attribute :api_key
@nicholaides
nicholaides / decode_gelf.rb
Created February 21, 2014 18:51
Decode GELF data
def decode(data)
JSON.parse(Zlib::Inflate.inflate(data.join.each_byte.to_a.pack('C*')))
end
# usage: decode(APP_LOGGER.notify(some_data))
@nicholaides
nicholaides / response-keys.txt
Created October 27, 2013 18:16
CloudStack API response keys
account
accountdetails
accountid
accounttype
aclid
acltype
action
activeviewersessions
affinitygroup
algorithm
@nicholaides
nicholaides / jade_usage.js
Created April 1, 2011 16:20
How to use Jade client-side
window.Jade = require('jade');
JadeTemplates = {};
JadeTemplates["some_template"] = Jade.compile("li.feedback.exercise_item.checkbox\n input(type=\"hidden\", name=\"exercise[feedback_items_attributes][$order][_type]\", value=\"Checkbox\")\n\n - if (this.is_editing)\n != partial(\"item_actions\")\n\n .body\n .checkbox\n input(type=\"checkbox\", disabled, checked)\n\n .title\n - if (this.is_editing)\n input(name=\"exercise[feedback_items_attributes][$order][title]\", value=this.title, placeholder=\"E.g. "I completed this exercise"\", \"data-bvalidator\"=\"required\")\n\n - if (this.is_viewing)\n label= this.title\n");
JadeTemplates["exercises/_Image"] = Jade.compile("a.image(href=this.file_url)\n\timg(src=this.file_thumb_url)\n");
// defines the helpers "exercise_item" and "partial"