Skip to content

Instantly share code, notes, and snippets.

View oisin's full-sized avatar
💭
Thing.

Oisín Hurley oisin

💭
Thing.
View GitHub Profile
@oisin
oisin / feedback.m
Created February 9, 2014 15:56
Changing the background colour of the Converser SDK generated feedback form.
# Simple tester for Converser SDK feedback form manipulation. No network connections
# made.
#import "CIOSecondViewController.h"
@interface CIOSecondViewController ()
@property (strong,nonatomic) VGConversationEngine *converser;
@end
@implementation CIOSecondViewController

Keybase proof

I hereby claim:

  • I am oisin on github.
  • I am oisin (https://keybase.io/oisin) on keybase.
  • I have a public key whose fingerprint is 5A6B 3BEF B837 764F EAC4 FD6E 0D97 5065 C08C F6CF

To claim this, I am signing this object:

@oisin
oisin / gist:10116472
Created April 8, 2014 12:22
From https://coderwall.com/p/dz6ttq - code snippet to switch on/off logging moped commands when in the Rails console.
# This initializer adds a method, show_mongo, when running a rails console. When active, all
# moped commands (moped is mongoid's mongodb driver) will be logged inline in the console output.
# If called again, logging will be restored to normal (written to log files, not shown inline).
# Usage:
# > show_mongo
if defined?(Rails::Console)
def show_mongo
if Moped.logger == Rails.logger
Moped.logger = Logger.new($stdout)
@oisin
oisin / pr.md
Created May 27, 2014 12:30 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@oisin
oisin / crushem.sh
Last active August 29, 2015 14:02
Convert all TIFF files in the current directory to PNG
# Crush all the Pings!
for i in *.png
pngcrush "$i" `basename -s .png "$i"`-crushed.png
@oisin
oisin / codereview.md
Created August 29, 2014 08:08
code-review

This is a summary of an original prose piece

Author

  • Patches to be kept as small as practicable
  • Patches to be explained clearly

Reviewer

  • What is the intent of the patch?
@oisin
oisin / pool.rb
Created October 30, 2014 08:58
Simple Ruby thread pool as per http://burgestrand.se/code/ruby-thread-pool/
require 'thread'
module Alert
def self.yikes(msg)
# Use this to log/trigger monitor
puts msg
end
end
# See http://burgestrand.se/code/ruby-thread-pool/
@oisin
oisin / Log Requests
Last active August 29, 2015 14:09
HTTP Server that will print the JSON arriving from a client.
Simple server which just formats and prints JSON requests.
@oisin
oisin / gist:952572
Created May 2, 2011 23:36
API version checking using Sinatra's before filter
require 'sinatra'
# Set the version of the API being run here
#
MAJOR_VERSION = 1
MINOR_VERSION = 0
helpers do
def version_compatible?(nums)
return MAJOR_VERSION == nums[0].to_i && MINOR_VERSION >= nums[1].to_i
@oisin
oisin / snarf-notes.rb
Created May 12, 2011 08:25
Grab notes from a Slideshare presentation and turn them into an HTML document
require 'rubygems'
require 'nokogiri'
require 'open-uri'
# Replace stupid 'smart' quotes in text, replace '\n' with real
# newlines, change selected diacritical marks
#
def cleaned(str)
str.gsub(/\\n/,"\n").gsub(/\‘|\’/, "'").gsub(/\”|\“/, '"').gsub(/í/, 'i')
end