Skip to content

Instantly share code, notes, and snippets.

View Tombert's full-sized avatar

Thomas Gebert Tombert

View GitHub Profile
Functional Programming In a Nutshell
================================
### History
The idea of functional programming has been around since well-before the invention of computers. The concepts of "partial application", "currying", and really higher level mathematics in-general lay out the framework used for the modern functional programming, more than its competing paradigms of imperative and Object-Oriented.
###What is Functional Programming?
In a nutshell, Functional programming is two things:
- Programming with the ideology that functions can be treated like a first-class-citizen
- Think about math class:
@Tombert
Tombert / FP
Created October 21, 2014 14:50
fp
Functional Programming In a Nutshell
================================
### History
The idea of functional programming has been around since well-before the invention of computers. The concepts of "partial application", "currying", and really higher level mathematics in-general lay out the framework used for the modern functional programming, more than its competing paradigms of imperative and Object-Oriented.
###What is Functional Programming?
In a nutshell, Functional programming is two things:
- Programming with the ideology that functions can be treated like a first-class-citizen
@Tombert
Tombert / derivative
Created October 21, 2014 14:57
FindingADerivative
Finding a derivative!
=====================
The definition of an derivative is as follows:
$$
\lim_{\Delta x \to 0} { {f(x+\Delta x) - f(x)} \over \Delta x}
$$
Given that:
@Tombert
Tombert / gist:76e02869e2fa4802fada
Last active August 29, 2015 14:13
Showing Rex how I'd do it
getUserObjectSomehow = () ->
id: 5
logged_in:true
do_something = (user) -> "> Logged in user #{user.id}: #{JSON.stringify(user, null, 4)}" unless !user.logged_in
# Admittedly this is mildly dependent on underscore or lodash.
log = console.log.bind(window)
@Tombert
Tombert / Proving Odd
Created January 21, 2015 20:20
Title4
A generalization for all even numbers is
$$
2k
$$
where k is an integer. Therefore, a generalization for all odd numbers would be.
$$
2k+1
$$
@Tombert
Tombert / dsfasdf
Created January 21, 2015 20:24
Title4
A generalization for all even numbers is
$$
2k
$$
where k is an integer. Therefore, a generalization for all odd numbers would be.
$$
2k+1
$$
@Tombert
Tombert / testing
Created January 21, 2015 20:26
Title4
<p>A generalization for all even numbers is <br>
<span class="MathJax_Preview"></span><div class="MathJax_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax" id="MathJax-Element-1-Frame"><nobr><span class="math" id="MathJax-Span-1" style="width: 1.143em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0.995em; height: 0px; font-size: 112%;"><span style="position: absolute; clip: rect(1.639em 1000.002em 2.631em -0.394em); top: -2.478em; left: 0.002em;"><span class="mrow" id="MathJax-Span-2"><span class="mn" id="MathJax-Span-3" style="font-family: STIXGeneral-Regular;">2</span><span class="mi" id="MathJax-Span-4" style="font-family: STIXGeneral-Italic;">k<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.002em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.483em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block
@Tombert
Tombert / rc.lua
Last active August 29, 2015 14:22
My AwesomeWM config
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
==> cowboy (compile)
Compiled src/cowboy_acceptors_sup.erl
Compiling src/cowboy_listener.erl failed:
src/cowboy_listener.erl:30: type queue/0 is deprecated and will be removed in OTP 18.0; use use queue:queue/0 or preferably queue:queue/1
src/cowboy_listener.erl:211: type queue/0 is deprecated and will be removed in OTP 18.0; use use queue:queue/0 or preferably queue:queue/1
src/cowboy_listener.erl:211: type queue/0 is deprecated and will be removed in OTP 18.0; use use queue:queue/0 or preferably queue:queue/1
Could not compile dependency cowboy, /usr/bin/rebar command failed. If you want to recompile this dependency, please run: mix deps.compile cowboy
@Tombert
Tombert / server.c
Created July 17, 2015 22:57
basicserver.c
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/ip.h> /* superset of previous */
int main( int argc, char **argv){
int tcp_socket;