Skip to content

Instantly share code, notes, and snippets.

View jjasonclark's full-sized avatar
🏠
Working from home

Jason Clark jjasonclark

🏠
Working from home
View GitHub Profile
Console.WriteLine("Hello, World");
@jjasonclark
jjasonclark / RangeFinder.cs
Created November 11, 2011 18:10
Find ranges in collection of ints
using System;
using System.Collections.Generic;
using System.Linq;
namespace Program
{
internal class RangeFinder
{
public static IEnumerable<T> Create<T>(IEnumerable<int> items, Func<int, int, T> rangeCreator)
{
@jjasonclark
jjasonclark / program.cs
Created May 9, 2012 21:42
Brute force sudoku solver
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
@jjasonclark
jjasonclark / generate-rails-gem-tags
Created July 12, 2012 16:29 — forked from AndrewRadev/generate-rails-gem-tags
Create ctags for all required gems
#! /usr/bin/env ruby
# Generate all tags for all gems included by bundler in gems.tags
#
# Basically does the same as "bundle show gemname", except for all gems.
# Interestingly enough, "bundle show" without any arguments falls back to
# "bundle list", otherwise the whole thing could have been a bash one-liner.
require 'bundler'
#!/bin/sh
tmux -S /tmp/pair has-session -t workenv
if [[ $? == 1 ]] ; then
pushd /Volumes/Analog/super-banner
tmux -S /tmp/pair new-session -d -s workenv -n Vim
tmux -S /tmp/pair new-window -t workenv -n Super-Banner
cd /Volumes/Analog/cookbooks
tmux -S /tmp/pair new-window -t workenv -n Cookbooks
tmux -S /tmp/pair select-window -t workenv:Vim
require 'minitest/spec'
require 'minitest/autorun'
class Credentials < Struct.new(:login, :password) ; end
class EnvironmentCredentials < Credentials
def initialize()
super(ENV['USER'], ENV['PASSWORD'])
end
end
@jjasonclark
jjasonclark / gist:5987491
Last active December 19, 2015 16:58
Ruby install script
# Install Ruby
if [ "`ruby --version | cut -d' ' -f2`" != "1.9.3p429" ] ; then
yum -y install kernel-devel gcc gcc-c++ automake autoconf make dmidecode zlib zlib-devel readline readline-devel openssl openssl-devel patch libtool libyaml-devel libffi-devel libxml2-devel libxslt-devel
mkdir -p /tmp/ruby
cd /tmp/ruby
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p429.tar.gz -q
tar xvf ruby-1.9.3*.tar.gz
cd ruby-1.9.3*
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
@jjasonclark
jjasonclark / tclient.rb
Created August 1, 2013 03:50 — forked from jstorimer/tclient.rb
These scripts were the result of the "Faster Rails test runs...with Unix!" screencast at https://www.youtube.com/watch?v=RSehcT4MnRM.
#!/usr/bin/env ruby
require 'socket'
test_file = ARGV[0]
socket = UNIXSocket.new('testing.sock')
socket.write(test_file)
socket.close_write
module Logic
class Authentication
def initialize session_hash, model = ::Authentication
@session = session_hash
@model = model
end
def signed_in?
!user.nil?
end
using System;
using System.Collections.Generic;
using System.IO;
namespace fixkeypath
{
class TextReadLineIterator : IDisposable, IEnumerable<string>
{
public TextReadLineIterator(TextReader InputFile)
{