This file contains 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
vi | |
automating actions through repetition and composition | |
with strengths to ubiquity and use through the terminal | |
"programmable editing" | |
emacs | |
extensibility by way of the power of lisp | |
make the editor do everything that you want in the way you want | |
make these functionalities easy to put in and pull out | |
a truly "programmable" editor |
This file contains 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
colo elflord |
This file contains 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
require 'chunky_png' # viewable at: http://i.imgur.com/C9Utu2N.png | |
palette = ["X","O","#","*","o","%","=","-","."] | |
puts ChunkyPNG::Image.from_file("poke_red.png").pixels.map {|p| p/256 % 256}.each_slice(160).map {|r| r.map {|n| palette[9-n/10*100/256]}.join("") }.join("\n") | |
=begin | |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
This file contains 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
# Install tmux on Centos release 6.5 | |
# install deps | |
yum install gcc kernel-devel make ncurses-devel | |
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL | |
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz | |
tar -xvzf libevent-2.0.21-stable.tar.gz | |
cd libevent-2.0.21-stable | |
./configure --prefix=/usr/local |
This file contains 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
import java.util.function.Function; | |
// Maybe is a monad. Why is it a monad? It is a monad because it: | |
// A) wraps a value | |
// B) provides a way of applying functions/calling methods on the wrapped value | |
// C) always returns an instance of itself when it does this. | |
class Maybe<T> { | |
private T value; | |
public Maybe(T value) { |
This file contains 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 Maybe | |
def initialize(value) | |
@value = value | |
end | |
def map(&block) | |
Maybe.new(bind &block) | |
end | |
def bind |
This file contains 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 User | |
attr_reader :hashed_pass | |
def initalize | |
@hashed_pass = "" | |
end | |
def change_profile_pic(other_pic) | |
@profile_pic = other_pic | |
end | |
end |
This file contains 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
db = [{name: "Jim", secret: "I peed my pants.", super_secret: "I love Nickleback."}] | |
user = {name: "Jim"} | |
get_secret = -> user { secret = db.find {|db_user| db_user[:name] == user[:name]}[:secret]; user.merge({secret: secret}) } | |
get_super_secret = -> user { super_secret = db.find {|db_user| db_user[:name] == user[:name]}[:super_secret]; user.merge({super_secret: super_secret}) } | |
bind = -> x, f { x[:secure] ? f[x[:value]].merge({secure: true}) : x } # security-aware manner of calling functions/methods | |
unit = -> n { {secure: false, value: n} } # makes objects security-aware | |
lift = -> f { -> x { unit[f[x]] } } # makes functions/methods security-aware |
This file contains 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
// Run online: https://eval.in/506636 | |
#include <iostream> | |
#include <functional> | |
// curries any function from (int, int) -> int into int -> (int -> int) | |
auto curry(int (*func)(int, int)) -> std::function<std::function<int (int)> (int)> { | |
return [func] (int x) { | |
return [func, x] (int y) { | |
return func(x, y); | |
}; |
This file contains 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
irb(main):010:0> Parser::CurrentRuby.parse("\"123\" =~ /1/") | |
=> (send | |
(str "123") :=~ | |
(regexp | |
(str "1") | |
(regopt))) | |
irb(main):011:0> Parser::CurrentRuby.parse("\"123\" !=~ /1/") | |
=> (send | |
(str "123") :!= | |
(send |