This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "net/http" | |
| "github.com/mrkplt/end_point/models" | |
| ) | |
| func main() { | |
| http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | |
| w.Header().Set("Content-Type", "application/json") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Keybase proof | |
| I hereby claim: | |
| * I am mrkplt on github. | |
| * I am mrkplt (https://keybase.io/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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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? | |
| end | |
| private |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class A | |
| attr_reader :b | |
| def initialize | |
| @b = B.new | |
| end | |
| end | |
| class B | |
| attr_reader :c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| useless_abstraction_three.last | |
| end | |
| private |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| messages := make(chan string) | |
| return_messages := make(chan string) | |
| go func() { return_messages <- "ping" }() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://www.youtube.com/watch?v=gRpUfjTwSOo&utm_source=golangweekly&utm_medium=email | |
| package main | |
| import "fmt" | |
| type user struct { | |
| name string | |
| email string | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # http://www.brianstorti.com/implementing-a-priority-queue-in-ruby | |
| class PriorityQueue | |
| attr_reader :elements | |
| def initialize | |
| @elements = [nil] | |
| end | |
| def <<(element) | |
| @elements << element |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BusinessObject | |
| class LambdaError < StandardError; end; | |
| class NotImplementedError < StandardError; end; | |
| def initialize(lambda_hash = {}) | |
| post_init(lambda_hash) | |
| end | |
| def perform | |
| raise NotImplementedError, 'must implement perform.' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ViewModel | |
| def initialize(klass) | |
| @klass = klass | |
| end | |
| private | |
| attr_accessor :klass | |
| def method_missing(method_sym, *arguments, &block) |
NewerOlder