Skip to content

Instantly share code, notes, and snippets.

View thinkingserious's full-sized avatar
🦉

Elmer Thomas thinkingserious

🦉
View GitHub Profile
@thinkingserious
thinkingserious / fluent.rb
Created May 24, 2016 02:28
Fluent Interface in Ruby Using Method Chaining and Reflection
class Fluent
def initialize(cache: nil)
@cache = cache ? cache : []
end
# Reflection
def method_missing(name, *args, &block)
_(name.to_s)
end
@thinkingserious
thinkingserious / file1.py
Created May 11, 2016 22:29
Multi File Gist
print "Hello World"
@thinkingserious
thinkingserious / Fluent.cs
Last active May 10, 2016 16:26
Fluent Interface in C# Using Method Chaining and Reflection
using System;
using System.Dynamic;
namespace Fluent
{
class Client : DynamicObject
{
public string UrlPath;
public Client(string urlPath = null)
@thinkingserious
thinkingserious / fluent.php
Created May 9, 2016 16:43
Fluent Interface in PHP Using Method Chaining and Reflection
<?php
class Fluent {
function __construct($cache) {
$this->cache = ($cache ? $cache : []);
}
// Build the cache, and handle special cases
public function _($name) {
array_push($this->cache, $name);
@thinkingserious
thinkingserious / fluent.py
Created March 5, 2016 02:44
Fluent Interface in Python Using Method Chaining and Reflection
class Fluent:
def __init__(self, cache=None):
self._cache = cache or []
# Build the cache, and handle special cases
def _(self, name):
# Enables method chaining
return Fluent(self._cache+[name])
# Final method call

Keybase proof

I hereby claim:

  • I am thinkingserious on github.
  • I am thinkingserious (https://keybase.io/thinkingserious) on keybase.
  • I have a public key whose fingerprint is 64E5 2C12 D835 AEB8 A109 DFA2 990F 4A17 FDBF EDC1

To claim this, I am signing this object:

@thinkingserious
thinkingserious / gist:94cb5ccbae82d26e0acc
Created May 29, 2014 02:11
userapp-function-signup
function signup() {
UserApp.User.save({
login: document.getElementById("username").value,
first_name: document.getElementById("name").value,
email: document.getElementById("email").value,
password: document.getElementById("password").value
}, function(error, user) {
if (error) {
alert("Error: " + error.message);
} else {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="https://app.userapp.io/css/demo/tutorial.css">
</head>
<body>
<div class="container" style="text-align: center;">
@thinkingserious
thinkingserious / app.py
Created February 14, 2014 02:39
API Design with APIairy.io, Python and Flask example code
#!flask/bin/python
from flask import Flask, jsonify, abort, make_response, request
app = Flask(__name__)
folders = [
{
"id": 1,
"name": "Health",
"description": "This represents projects that are related to health",
@thinkingserious
thinkingserious / api-design-with-apiaryio
Last active August 29, 2015 13:56
GTD Todo API Blueprint Example
FORMAT: 1A
HOST: http://api.gtdtodoapi.com
# GTD TODO API
This is an example API, written as a companion to a blog post at SendGrid.com
## Folder [/folder{id}]
A single Folder object, it represents a single folder.
Required attributes: