Skip to content

Instantly share code, notes, and snippets.

Corey Haines coreyhaines

Block or report user

Report or block coreyhaines

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
@coreyhaines
coreyhaines / slack_delete.rb
Created Aug 21, 2016 — forked from jamescmartinez/slack_delete.rb
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
View slack_delete.rb
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
View Cleanedup_Item.elm
updateItemBasedOnEditItemState : EditItemType -> Item -> Item
updateItemBasedOnEditItemState editItemType item =
let
stopEditing : { item | typeData : ItemTypeData } -> (Maybe.Maybe newEditState -> ItemTypeData) -> { item | typeData : ItemTypeData }
stopEditing item itemTypeDataWithoutEditState =
{ item | typeData = itemTypeDataWithoutEditState Nothing }
updateEditingState : { item | typeData : ItemTypeData } -> (Maybe.Maybe newEditState -> ItemTypeData) -> newEditState -> { item | typeData : ItemTypeData }
updateEditingState item itemTypeDataWithoutEditState editItem =
{ item | typeData = itemTypeDataWithoutEditState (Just editItem) }
@coreyhaines
coreyhaines / outline
Created May 4, 2016
Fun with Lambdas
View outline
# Welcome
## Start with a Lambda
## Get to Hello, world
# What is a lambda
## Ruby Syntax
## Identity
## K
## GetFirst
## GetSecond
@coreyhaines
coreyhaines / abstract
Created Apr 6, 2016
Prolog Talk Abstration
View abstract
Title: I don't know Prolog, and so can you
Abstract: Prolog is a wildly popular declarative logic programming language that all the hot startups and whiz kids are using these days. So, being neither a hot startup nor a whiz kid, I figured I'd learn it. In this talk, I'll share some of the early learnings I've had that can only be considered "mind-bending."
We'll look at a bit of the syntax, the solver model and then dive into some wild and crazy list operations. Finding all the combinatorial variations of a list using the function isMember? Yup! We'll do that.
If you are anything like me, and I know you are, you'll come away from this talk saying "I'm sold! PROLOG FOREVER!"
@coreyhaines
coreyhaines / replacement.rb
Last active Aug 29, 2015
Basic templating - better way?
View replacement.rb
def render_template template, question:
template % {
:"question.text" => CGI::escapeHTML(question.display_text.to_s),
:"question.name" => CGI::escapeHTML(question.name.to_s),
:"question.email" => CGI::escapeHTML(question.email.to_s)
}
end
View gist:8545bc5624d50bdae14c
class TypeStack {
public void push(T obj);
public T pop<T>();
public T peek<T>();
}
var stack = new TypeStack();
stack.push("hello");
var o = new OtherType();
stack.push(o);
View Super Awesome Fun Coding Workshop, Great Job
Idea based on this tweet exchange:
coreyhaines: Architecture where ever class is its own gem, communicating via drb. #thoughtleadering #thoughtlendering
coreyhaines: better yet, every method is its won gem, classes are built up by requiring gems that monkey-patch. #truth
josh_cheek: @coreyhaines As each method is a gem, it needs its a namespace, so it's defined in a module… Compose classes by including method's modules.
coreyhaines: @josh_cheek I do like the idea of composing via module inclusions, as well. Interesting.
coreyhaines: Seriously, though, the idea of defining classes via including single-method modules appeals to me.
So, here's my thought for the workshop. It is based a bit on some of the value that I saw doing coderetreats.
title: Super Awesome Happy Fun Coding Workshop, Great Job
@coreyhaines
coreyhaines / filters.rb
Created Apr 5, 2015
The boss of metaprogramming
View filters.rb
# You know you are the boss, when you take this
def filter(questions_query)
filter_categories filter_incomplete questions_query
end
def filter_incomplete(query)
filtering_on?(:incomplete) ? query.incomplete : query
end
def filter_categories(query)
filtering_on?(:categories) ? query.in_categories(*@original_params[:categories]) : query
@coreyhaines
coreyhaines / abstract
Last active Aug 29, 2015
Craft Conf Abstract
View abstract
# abstract for my talk at Craft Conf 2015 (http://craft-conf.com/2015)
You've probably heard about the lambda calculus, building up our computing structures from just the treasured lambda. But how much have you played with it?
In this talk, armed only with Vim and the CLI, we'll explore some interesting topics in building up our world with just the lambda and the thought process while doing it. While you probably don't want to program day-to-day at this level, it definitely can help with how you think about your regular programming.
This talk consists almost entirely of live coding. FUN TIMES!
View prompt.sh
export PROMPT_COMMAND='prompt_status=$?'
export PS1='$(if [[ $prompt_status == 0 ]]; then echo "¯\_(ツ)_/¯"; else echo "ᕕ( ᐛ )ᕗ"; fi) 🐈 $'
You can’t perform that action at this time.