Skip to content

Instantly share code, notes, and snippets.

@starmer
starmer / intro.html
Created October 1, 2021 02:55
Coderpad.io interview sandbox introduction
<html>
<head>
<meta charset="UTF-8">
<title>React Pad</title>
<script src="https://unpkg.com/[email protected]/umd/react.production.min.js"></script>
<script src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/@babel/[email protected]/babel.min.js"></script>
</head>
<body>
<div id="root"/>
@starmer
starmer / part_1_instructions.md
Created November 29, 2015 23:01
CD Part 1 Instructions

Login to your OpenStack UI (aka Horizon)

Navigate through the side bar to:

Project > Compute > Access & Security

Click on the Security Groups tab

Click Manage Rules

@starmer
starmer / gist:8919366
Created February 10, 2014 16:38
Help!
// Option 1
Pojo pojo = new Pojo();
pojo.setState("AWESOME");
assertEquals("AWESOME", pojo.setState());
////////////////// or
// Option 2
Pojo pojo = new Pojo();
String expected = "AWESOME";
@starmer
starmer / Rakefile
Created July 26, 2013 10:55
Rake task to create a new post for a jekyll blog
task :new, :title do |t, args|
if args.to_hash.empty?
puts 'usage: rake new["New Post Title"]'
next
end
title = args.title
slug = title.downcase.gsub(/\s/, '-')
file_name = "_posts/" + Time.new().strftime("%Y-%m-%d") + "-#{slug}.md"
@starmer
starmer / priority_queue.rb
Created August 13, 2012 02:39
PriorityQueue
require 'set'
class PriorityQueue
def initialize
@pq = SortedSet.new
end
def insert key, value
entry = find(key) || Entry.new(key)
entry.add(value)
@starmer
starmer / diptych.rb
Created February 5, 2012 19:03
Create a diptych (combine two images together)
require 'rubygems'
require 'RMagick'
include Magick
if ARGV.length < 4
puts "Usage: ruby diptych.rb <new image> <left image> <right image> <width>"
else
left_img = Image.read(ARGV[1])[0];
right_img = Image.read(ARGV[2])[0];
@starmer
starmer / ellipsis.css
Created March 10, 2011 21:37
Ellipsis in CSS
// http://www.mattsnider.com/css/css-string-truncation-with-ellipsis
.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
-moz-binding: url('ellipsis.xml#ellipsis');
}
@starmer
starmer / gist:780074
Created January 14, 2011 19:20
Print JavaScript Call Stack
//from http://eriwen.com/javascript/js-stack-trace/
var currentFunction = arguments.callee.caller;
while (currentFunction) {
console.log(currentFunction);
var fn = currentFunction.toString();
var fname = fn.substring(fn.indexOf('function') + 8, fn.indexOf('')) || 'anonymous';
//console.log(fn);
currentFunction = currentFunction.caller;
}
/* new clearfix */
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
* html .clearfix { zoom: 1; } /* IE6 */