Skip to content

Instantly share code, notes, and snippets.

View ghostandthemachine's full-sized avatar

Jon Rose ghostandthemachine

  • Origin Rose
  • Boulder, Colorado
View GitHub Profile
(defn- attach
"Takes a function to clone and a map of CSF related values
including:
- :args
- :arg-types
- :parameters
These are then properly named and assigned to the template prototype
@ghostandthemachine
ghostandthemachine / polling.cljs
Created December 4, 2017 16:07
An example of polling using cljs and setInterval
;; Time between polling requests in milliseconds
(def TIMEOUT 1000)
(defn polling-request
[handler timeout]
;; Will call the handler every timeout interval
(js/setInterval handler timeout))
@ghostandthemachine
ghostandthemachine / .tmux.conf
Created March 16, 2016 22:57 — forked from snuggs/.tmux.conf
TMUX configuration file
##############################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#############################
#
# COPY AND PASTE
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);

Clojure on Raspberry Pi with OS X

"Clojure running on Raspberry Pi" sounded so cool that I just had to give it a try.

Install JDK

  • Download ARM JDK from Oracle and instlal on Raspberry Pi
  • Change visudo to contain the following
@ghostandthemachine
ghostandthemachine / easing.js
Last active August 29, 2015 14:08 — forked from gre/easing.js
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
; Ruby has an awesome feature -- string interpolation. Read about it on the internet.
; On the other hand, Clojure only has cumbersome Java string formatting, which can not be
; used without pain after you've tried Ruby.
; So here's this simple macro that basically allows you to do most things you could do
; with Ruby string interpolation in Clojure.
(ns eis.stuff
(:require [clojure.string]))
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#

Keybase proof

I hereby claim:

  • I am ghostandthemachine on github.
  • I am jonrose (https://keybase.io/jonrose) on keybase.
  • I have a public key whose fingerprint is B473 C5C4 D353 D018 D4FA 76E1 A82A 9D0C 8D31 BEBF

To claim this, I am signing this object:

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one