Skip to content

Instantly share code, notes, and snippets.

Mark Platt mrkplt

Block or report user

Report or block mrkplt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sublime-user-preferences.txt
"auto_indent": true,
"bold_folder_labels": true,
"detect_indentation": true,
"fade_fold_buttons": false,
"font_face": "Fira Mono OT",
"font_size": 13.0,
"highlight_line": true,
mrkplt / potty_mouth.rb
Last active Aug 29, 2015
You've got a potty mouth
View potty_mouth.rb
require 'csv_class_maker'
CsvClassMaker.generate_class('MyTweets', '/Users/mplatt/Downloads/tweets/tweets.csv')
curses ='piss|fuck|shit|dick|ass|damn', true)
all_tweets_count = MyTweets.all.size
my_curses_count ={ |t| t if t.text.match(curses) }.size
View http_traffic.rb
# extracted from
require 'webrick'
include WEBrick
class Simple < WEBrick::HTTPServlet::AbstractServlet
def do_POST(request, response)
puts "Body: " + request.body
puts "Header: " + request.raw_header.to_s
mrkplt / gist:c6fb95cb613fed2075bc
Created Jul 10, 2014
Turn in a string into a valid local variable name.
View gist:c6fb95cb613fed2075bc
def variablize(string)
sanitized_string = string.chomp('=')
sanitized_string = sanitized_string.gsub(/([^a-z0-9_])/i, '_')
sanitized_string[0] = sanitized_string[0].downcase.sub(/[0-9]/, '_')
mrkplt / view_model.rb
Last active Aug 29, 2015
A quick view model implementation
View view_model.rb
class ViewModel
def initialize(klass)
@klass = klass
attr_accessor :klass
def method_missing(method_sym, *arguments, &block)
mrkplt / business_object.rb
Last active Aug 29, 2015
A sort of fast mock up of how I think you could implement business logic that would be separated from data layer and controller.
View business_object.rb
class BusinessObject
class LambdaError < StandardError; end;
class NotImplementedError < StandardError; end;
def initialize(lambda_hash = {})
def perform
raise NotImplementedError, 'must implement perform.'
View priority_queue.rb
class PriorityQueue
attr_reader :elements
def initialize
@elements = [nil]
def <<(element)
@elements << element
View gist:b114d2525a03cfb95acd
package main
import "fmt"
type user struct {
name string
email string
mrkplt / gist:0b06015b4ecd00a55ce8
Last active Aug 29, 2015
Playing with Go channels
View gist:0b06015b4ecd00a55ce8
package main
import "fmt"
func main() {
messages := make(chan string)
return_messages := make(chan string)
go func() { return_messages <- "ping" }()
View gist:c86a8a5c7450d79d5ebb
class BadDemeter
# this is an example that abuses LoD. I am not saying that your code
# can't look like this for other reasons.
def thinger
You can’t perform that action at this time.