Skip to content

Instantly share code, notes, and snippets.

View kibiz0r's full-sized avatar

Michael Harrington kibiz0r

  • Grand Rapids, MI
View GitHub Profile
@kibiz0r
kibiz0r / designer.html
Last active August 29, 2015 14:16
designer
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="my-element">
<template>
<style>
@kibiz0r
kibiz0r / svn-add-all
Last active December 14, 2015 01:38
SVN equivalent of git add -A. Looks at your filesystem state and adds all un-added paths, removes all un-removed paths.
#!/usr/bin/env ruby
require 'fileutils'
require 'tmpdir'
removed_dirs = `svn st`.lines.map do |line|
if line =~ /^!\s*(.*)$/
$1
end
end.compact
@kibiz0r
kibiz0r / svn-revert-externals
Last active December 14, 2015 01:38
Reverts staged changes to SVN externals in a working copy.
#!/usr/bin/env ruby
external_dirs = `svn st`.lines.map do |line|
if line =~ /^Performing status on external item at '([^']*)'$/
$1
end
end.compact
external_dirs.each do |dir|
system "svn revert -R '#{dir}'"
@kibiz0r
kibiz0r / svn-unfuck
Created February 15, 2013 22:43
An SVN script to fix obstructed directories by copying their contents to a temporary directory, restoring the original directory through SVN, and then overlaying the desired contents.
#!/usr/bin/env ruby
require 'fileutils'
require 'tmpdir'
def ignored?(entry)
['.', '..', '.svn'].include? entry
end
def replicate_dir_contents(old_dir, new_dir)
unless File.directory? new_dir
public class LessThanOrEqualFilterRule : IFilterRule
{
public IEnumerable<Widget> Filter(IEnumerable<Widget> widgets)
{
return widgets.Where(w => w.foo <= 100);
}
}
public class EqualFilterRule : IFilterRule
{
# Boo
a = ( (1, 2), (3, 4) )
for i, j in a: # Boo supports unpacking!
print(i + j)
// C#
var arr = new int[][] { new int[] { 1, 2 }, new int[] { 3, 4 } };
foreach (var x in arr)
{
// No unpacking, must use array indices...
Console.WriteLine(x[0] + x[1]);
require "csv"
class AwesomeCsvReader
def initialize(importer)
@importer = importer
end
def read
CSV.foreach "large.csv" do |line|
@importer.import line
require 'ostruct'
class HockeyClient
def listen_for_hockey_scores
return enum_for(:listen_for_hockey_scores) unless block_given?
sleep 1
yield score "Blues", "Cracknell"
sleep 0.1
yield score "Red Wings", "Salei"
sleep 0.1
require 'ostruct'
class HockeyClient
def listen_for_hockey_scores
sleep 1
yield score "Blues", "Cracknell"
sleep 0.1
yield score "Red Wings", "Salei"
sleep 0.1
yield score "Red Wings", "Helm"
require 'ostruct'
class HockeyClient
def listen_for_hockey_scores
sleep 1
yield score "Blues", "Cracknell"
sleep 0.1
yield score "Red Wings", "Salei"
sleep 0.1
yield score "Red Wings", "Helm"