Skip to content

Instantly share code, notes, and snippets.

View rjattrill's full-sized avatar

Ross Attrill rjattrill

View GitHub Profile
package MarpaX::JSON;
use 5.010;
use strict;
use warnings;
use Marpa::R2 2.060000;
sub new {
my ($class) = @_;
@jeffreykegler
jeffreykegler / gist:4480523
Last active June 20, 2017 06:20
Example for "DSL's made even simpler" blog post
#!perl
# Copyright 2012 Jeffrey Kegler
# This file is part of Marpa::R2. Marpa::R2 is free software: you can
# redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# Marpa::R2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@briandfoy
briandfoy / find_unused_subs.pl
Created July 7, 2012 00:51
Find unused Perl subroutines
#!/usr/bin/perl
use v5.14;
use strict;
use warnings;
use PPI;
use Scalar::Util qw(blessed);
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@agibsonsw
agibsonsw / LastEditLine.py
Created March 7, 2012 13:32
ST Python to move between last edits (perfect)
import sublime, sublime_plugin
POSNS = {} # Based on each view's id, store edited positions.
# The first element stores the most recently edited line
# number, so that the same line is not saved repeatedly.
class LastEditLineCommand(sublime_plugin.TextCommand):
posn = -1 # always add 2 to this, which indexes the first
# edited position (for the current view)
def run(self, edit):
@mislav
mislav / gist:938183
Created April 23, 2011 02:28
Faraday SSL example
connection = Faraday::Connection.new('http://example.com') do |builder|
builder.request :url_encoded # for POST/PUT params
builder.adapter :net_http
end
# same as above, short form:
connection = Faraday.new 'http://example.com'
# GET
connection.get '/posts'