Skip to content

Instantly share code, notes, and snippets.

View lodestone's full-sized avatar
:octocat:
🤘Grokking Out 🤘

Matthew Petty lodestone

:octocat:
🤘Grokking Out 🤘
  • Kizmeta
  • Kansas City Area, Missouri
  • 12:09 (UTC -12:00)
View GitHub Profile
@lodestone
lodestone / cream_and_sugar.rb
Created January 30, 2012 20:33 — forked from joshuaclayton/cream_and_sugar.rb
Simple decorator pattern
require "money"
class Decorator < BasicObject
undef_method :==
def initialize(component)
@component = component
end
def method_missing(name, *args, &block)
@lodestone
lodestone / syntax_highlighting.py
Created April 11, 2012 15:53 — forked from JeanMertz/syntax_highlighting.py
Ruby on Rails syntax highlight switcher for Sublime Text 2
import sublime, sublime_plugin
import os
class DetectFileTypeCommand(sublime_plugin.EventListener):
""" Detects current file type if the file's extension isn't conclusive """
""" Modified for Ruby on Rails and Sublime Text 2 """
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """
def on_load(self, view):
filename = view.file_name()
@lodestone
lodestone / editscript.rb
Created July 7, 2012 22:47 — forked from ttscoff/editscript.rb
Fuzzy CLI file search through configured directories, ranked results displayed as menu
#!/usr/bin/env ruby
# encoding: utf-8
# == Synopsis
# Proof of concept using Fuzzy File Finder to locate a script to edit
# Searches a set of predefined locations for a fuzzy string
# e.g. "mwp" matches both "myweatherprogram" and "mowthelawnplease"
# ................on "(m)y(w)eather(p)rogram" and "(m)o(w)thelawn(p)lease"
#
# Results are ranked and a menu is displayed with the most likely
# match at the top. Editor to be launched and directories to search
application:open-your-keymap
application:open-your-stylesheet
autocomplete:attach
autoflow:reflow-paragraph
bookmarks:clear-bookmarks
bookmarks:jump-to-next-bookmark
bookmarks:jump-to-previous-bookmark
bookmarks:toggle-bookmark
bookmarks:view-all
check:correct-misspelling
@lodestone
lodestone / echoHttpRequest.js
Last active August 29, 2015 14:08 — forked from Marak/echoHttpRequest.js
Echo HTTP requests
module['exports'] = function echoHttp (hook) {
hook.debug("Debug messages are sent to the debug console");
hook.debug(hook.params);
hook.debug(hook.req.path);
hook.debug(hook.req.method);
@lodestone
lodestone / isTheWebsiteDown.js
Last active August 29, 2015 14:08 — forked from Marak/isTheWebsiteDown.js
Checks to see if a website is down
var http = require('http');
module['exports'] = function isTheWebSiteDown (hook) {
http.get(hook.params.url, function(res){
hook.debug(hook.params.url + " is up and running.")
hook.res.end('false');
}).on('error', function (){
hook.debug(hook.params.url + " is DOWN!")
hook.res.end('true');
});
@lodestone
lodestone / 0-readme.md
Last active August 29, 2015 14:09 — forked from burke/0-readme.md

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@lodestone
lodestone / Rakefile
Last active August 29, 2015 14:10 — forked from rjsamson/Rakefile
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/osx'
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'MenubarApp'
app.info_plist['NSUIElement'] = 1
end
require 'pdf-reader'
require './markup_receiver'
doc = PDF::Reader.new(ARGV[0])
$objects = doc.objects
def is_note?(object)
object[:Type] == :Annot && [:Text, :FreeText].include?(object[:Subtype])
end
@lodestone
lodestone / predict.rb
Last active August 29, 2015 14:23 — forked from inukshuk/predict.rb
#!/usr/bin/env ruby
require 'csl/styles'
require 'citeproc/ruby'
require 'httparty'
require 'thread'
API_KEY = '' # Add your key here!
exit if API_KEY.empty?