Skip to content

Instantly share code, notes, and snippets.

😴
= (λx.x x)(λx.x x)

Nathan Lilienthal nixpulvis

😴
= (λx.x x)(λx.x x)
Block or report user

Report or block nixpulvis

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
@nixpulvis
nixpulvis / triangle.scss
Created Jan 30, 2014
Make some pretty triangles.
View triangle.scss
@mixin triangle($size, $color, $direction) {
width: 0;
height: 0;
@if $direction == 'up' {
border-left: $size solid transparent;
border-right: $size solid transparent;
border-bottom: $size solid $color;
} @elseif $direction == 'down' {
border-left: $size solid transparent;
@nixpulvis
nixpulvis / exceptions.rb
Created Feb 19, 2014
Add pundit authorization to Rails exception logic.
View exceptions.rb
module ActionDispatch
class ExceptionWrapper
@@rescue_responses.merge!('Pundit::NotAuthorizedError' => :forbidden)
end
end
View palindate.rb
require 'date'
def palindate?(date)
padded_month = "%02d" % date.month
padded_day = "%02d" % date.day
both_pad = "#{padded_month}#{padded_day}#{date.year}"
month_pad = "#{padded_month}#{date.day}#{date.year}"
day_pad = "#{date.month}#{padded_day}#{date.year}"
@nixpulvis
nixpulvis / simple_cookie_session.rb
Last active Aug 29, 2015
Simplistic Cookie Session
View simple_cookie_session.rb
@nixpulvis
nixpulvis / contiguous_2d_matrix.c
Last active Aug 29, 2015
Contiguous 2D Matrix C99
View contiguous_2d_matrix.c
int main(int argc, char **argv) {
size_t rows = atoi(argv[1]);
size_t columns = atoi(argv[2]);
/* This is really cool!!! */
int (*matrix)[columns] = malloc(sizeof(*matrix) * rows);
if (matrix) {
matrix[0][0] = 13;
matrix[1][0] = 1;
@nixpulvis
nixpulvis / cfg.rb
Last active Aug 29, 2015
Scalar register propagation.
View cfg.rb
require 'pp'
class BasicBlock
include Enumerable
attr_accessor :instructions, :children
def initialize(&block)
@instructions = []
@children = []
@nixpulvis
nixpulvis / unused_define.rb
Created Aug 18, 2014
Simple unused #define finder.
View unused_define.rb
#!/usr/bin/env ruby
require 'pp'
if ARGV[0]
# Collect defines.
defines = {}
Dir.glob("#{ARGV[0]}/**/*.{c,h}") do |path|
File.open(path, "r") do |file|
View lambda_fib.rkt
;; Credit Eli Barzilay
(λ(f)(λ
(x)(((x(λ(
x)(λ(x y)y)
)(λ(x y)x))(
x(λ(x)(λ(x y)
y))(λ(x y
)x))(((
x(λ(p)(
View macro.rkt
;; A macro that defines a PDA language
(define-syntax pushdown
(syntax-rules (: ->)
[(pushdown init-state end-state
[state : (input-stream input-stack -> new-state new-stack) ...]
...)
(lambda (string)
(: state : (Listof Token) (Listof Token) -> Boolean)
...
(define (state stream stack)
View nixpulvis.terminal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBrightBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw
LjQ1ODgyMzU2MTcgMC40NDMxMzcyODgxIDAuMzY4NjI3NDU4OAAQAoAC0hAREhNaJGNs
YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp
You can’t perform that action at this time.