Skip to content

Instantly share code, notes, and snippets.

View DavidJRobertson's full-sized avatar

David Robertson DavidJRobertson

View GitHub Profile
@DavidJRobertson
DavidJRobertson / FixAdventureMainClass.java
Created July 13, 2013 22:01
FixAdventure: bukkit plugin that prevents all block breaking/placement while in adventure mode.
package me.davidr.fixadventure;
import org.bukkit.GameMode;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.Listener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
function separateLines (input, chars) {
var lines = [];
while (input.length > chars) {
var text = input.substr(0, chars);
var i = text.lastIndexOf(" ");
if (i == -1) {
i = chars - 1;
}
@DavidJRobertson
DavidJRobertson / stealify.js
Last active January 30, 2018 10:53
Stealify: pinch Spotify music! Run using node.js.
// Stealify
//
// A wee HTTP proxy to steal MP3 files from https://play.spotify.com
// By David Robertson
console.log("Stealify started! Instructions:");
console.log("1. Set http://localhost:8080 as your HTTP proxy");
console.log("2. Go to http://play.spotify.com in your browser and start playing music");
console.log("3. Wonder at all the stolen music appearing in this directory! Woo!");
console.log("Remember to reverse the HTTP proxy settings when you're done :P\n");
@DavidJRobertson
DavidJRobertson / gist:4260680
Created December 11, 2012 18:00
Ruby: pretty directory recursion :P
# EDIT: this can actually be done more simply like this:
Dir.foreach("path/to/directory/**/*") do |item|
next if File.directory? item
# Do whatever with item now
end
# Define this somewhere
def each_file(dir = ".", &block)
Dir.foreach(dir) do |item|
#! /usr/bin/env ruby
require 'yaml'
require 'pp'
require 'erubis'
require 'mp3info'
require 'aws/s3'
require 'digest'
def reload_config
Fags, Mags And Bags - S01 - E01 - Raising Keenan.mp3:
title: FMB S01 E01 Raising Keenan
date: 8 dec 2012
synopsis: Fags, mags and bags' first episode!
tags:
- fags
- mags
- bags
two.mp3:
title: Episode Two
require 'rubygems'
require 'tumblr_client'
require 'uri'
GIF_MAX_WIDTH = 1024
GIF_MAX_HEIGHT = 768
Tumblr.configure do |config|
config.consumer_key = "AcHYlG5GaS9xf842H1RC8WF81cvAH9zqf7fvxGSrfHQSy7ksqO"
require 'rubygems'
require 'tumblr_client'
require 'active_record'
GIF_MAX_WIDTH = 1024
GIF_MAX_HEIGHT = 768
Tumblr.configure do |config|
config.consumer_key = "AcHYlG5GaS9xf842H1RC8WF81cvAH9zqf7fvxGSrfHQSy7ksqO"
require 'rubygems'
require 'tumblr_client'
Tumblr.configure do |config|
config.consumer_key = "AcHYlG5GaS9xf842H1RC8WF81cvAH9zqf7fvxGSrfHQSy7ksqO"
config.consumer_secret = "SYfZQUh6kGgEG3zAtQwO9jJwGEDcVXBMRg1QUTRIMZqBqDHMUR"
end
tumblr = Tumblr.new
@DavidJRobertson
DavidJRobertson / dcpu-asm.md
Created October 15, 2012 18:47
DCPU ASSEMBLER

Scroll down for assembler ruby source code

DCPU Assembler

Comments

Start with a # and can be on their own line or at the end of a line of code

Labels