Skip to content

Instantly share code, notes, and snippets.

View end_point.go
package main
import (
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
View gist:f5194a782aac210e930c
### Keybase proof
I hereby claim:
* I am mrkplt on github.
* I am mrkplt ( on keybase.
* I have a public key whose fingerprint is B63F B8E1 BE81 FBAF E770 6DB7 2D7F 0EBC 0074 AC2E
To claim this, I am signing this object:
mrkplt / environment_check.rb
Last active Aug 29, 2015
Environment check for safer rake tasks.
View environment_check.rb
module EnvironmentCheck
MESSAGE = "This action is destructive. Proceed?"
def self.execute(message = MESSAGE)
return command_line_output unless inquiry(message) == 'y'
yield if block_given?
mrkplt / gist:7fb65807e60e9ce8aec2
Last active Aug 29, 2015
Awful coupling, Demeter violation
View gist:7fb65807e60e9ce8aec2
class A
attr_reader :b
def initialize
@b =
class B
attr_reader :c
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
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:b114d2525a03cfb95acd
package main
import "fmt"
type user struct {
name string
email string
View priority_queue.rb
class PriorityQueue
attr_reader :elements
def initialize
@elements = [nil]
def <<(element)
@elements << element
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.'
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)
You can’t perform that action at this time.