Skip to content

Instantly share code, notes, and snippets.

@franc
franc / window.ex
Created September 3, 2015 15:55
elixir attempt at getting WX to draw a line
defmodule AudioRenderer.Window do
@moduledoc """
A window to draw our audio renderer within.
"""
@title 'Audio Renderer'
require Record
Record.defrecordp :wx, Record.extract(:wx, from_lib: "wx/include/wx.hrl")
Record.defrecordp :wxClose, Record.extract(:wxClose, from_lib: "wx/include/wx.hrl")

Keybase proof

I hereby claim:

  • I am franc on github.
  • I am franc (https://keybase.io/franc) on keybase.
  • I have a public key whose fingerprint is F2CD 2216 526F B1F8 0792 F7EA FA96 344F E1C0 17D5

To claim this, I am signing this object:

Verifying that +franc is my openname (Bitcoin username). https://onename.io/franc
@franc
franc / elixir_compress_demo.ex
Created April 23, 2014 07:28
demo of Elixir pattern matching. - based on Dave's Demo, with added comments.
#
# Given a list, return a new list with all occurrences of consecutive
# duplicated elements replaced by `{element, count}`
#
# compress [ 1,2,2,3,4,4,4,5,6,6]
# → [1, {2, 2}, 3, {4, 3}, 5, {6, 2}]
#
# this version instead peeks at two elements from the source
@franc
franc / csreview-130210
Created February 10, 2013 06:54
brief review of the book, CoffeeScript Programming with jQuery, Rails, and Node.js, by Michael Erasmus http://www.packtpub.com/coffeescript-programming-with-jquery-rails-nodejs/book
This book refreshingly doesn't start with installation instructions.
It rather takes the approach of showing how CoffeeScript differs from JavaScript, how it fixes the bad parts, makes the good parts more accessible and how it adds a number of new parts, designed to make your code better and your life easier.
This section takes the form of a show and tell, where the author runs through the language features and shows how CoffeeScript makes everything clearer, more concise and easier by bringing the best parts of other popular languages to JavaScript. It also shows the JavaScript generated by the CoffeeScript examples which functions as a clear reminder of how much pain is involved with doing JavaScript right.
We are shown how JavaScript's underlying Object Oriented structure is made extremely accessible through CoffeeScript's class and inheritance syntax that is based on that of Ruby.
Shortly after we are introduced to list comprehension that brings Python's functional constructs to CoffeeScript.
ROMAN_SYMBOLS =
'I' : 1
'IV' : 4
'V' : 5
'IX' : 9
'X' : 10
'XL' : 40
'L' : 50
'XC' : 90
'C' : 100
@franc
franc / spineforge.thor
Created July 8, 2012 16:27
thor script for building Spine.js & Trigger.io Forge app
class Spineforge < Thor
include Thor::Actions
# thor spineforge:fuse ios
desc "fuse ios/android","builds and runs app"
def fuse(platform)
#cd spineapp
@spineapp_dir = File.dirname(__FILE__)
@forge_dir = @spineapp_dir + '/../'
inside @spineapp_dir do
Rolify.configure do |config|
# By default ORM adapter is ActiveRecord. uncomment to use mongoid
config.use_mongoid
# Dynamic shortcuts for User class (user.is_admin? like methods). Default is: false
config.use_dynamic_shortcuts
end
class User
include Mongoid::Document
@franc
franc / ecom setup tx call
Created February 7, 2012 10:51
CS without comments
$(document).ready ->
imb_staging_server = undefined
post_options = undefined
ten_minutes_from_now = undefined
transaction_setup_call = undefined
tx_setup_url = undefined
ten_minutes_from_now = ->
i = undefined
s = undefined
size = undefined