Skip to content

Instantly share code, notes, and snippets.

View cadwallion's full-sized avatar
⚒️
Building all the things

Andrew Nordman cadwallion

⚒️
Building all the things
View GitHub Profile
@cadwallion
cadwallion / deck.rs
Last active March 11, 2018 19:42
Card Display
enum Card {
Heart(i32),
Spade(i32),
Diamond(i32),
Club(i32),
}
impl Card {
fn value_to_string(&self, value: i32) -> String {
match value {
require ['media-uploader'], (MediaUploader) ->
class Rise.Views.Teach.Lessons.UploadContentModal extends MediaUploader.UploadModal
el: '#upload-modal'
FILE_TYPES:
'Content::Document': ['pdf']
'Content::Media': ['video', 'audio']
initialize: ->
setDefaults()
@cadwallion
cadwallion / gist:831fc3449d9ff746fd65
Last active August 29, 2015 14:00
Case statement with arrays
def getElementBonus elementA, elementB
case [elementA, elementB]
when ['Fire', 'Life']
return 3
when ['Water', 'Fire']
return 3
when ['Life', 'Water']
return 3
else
return 0
@cadwallion
cadwallion / kettle_control.rb
Created April 29, 2014 14:47
Multi-process PID control
#!/usr/bin/env ruby
require 'brewby'
Signal.trap("INT") { exit }
heat_reader, heat_writer = IO.pipe
heat_pid = fork do
heat_writer.close
adapter = Brewby::Outputs::Test.new
output = Brewby::HeatingElement.new adapter, pulse_range: 5000
@cadwallion
cadwallion / config.log
Last active December 26, 2015 02:49
JFFI build failure on ARM
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libffi configure 3.0.10, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ /root/jffi/jni/libffi/configure --disable-static --with-pic=yes --disable-dependency-tracking
## --------- ##
## Platform. ##
@cadwallion
cadwallion / gist:7010014
Created October 16, 2013 15:46
JRuby FFI Failure on Raspberry Pi
root@raspberrypi:~/brewby# jruby -J-Xmx200m bin/brewby start --config ~/.testbrewbyrc --recipe examples/brewby_recipe.rb
LoadError: Could not load FFI Provider: (NotImplementedError) FFI not available: null
See http://jira.codehaus.org/browse/JRUBY-4583
require at org/jruby/RubyKernel.java:1082
(root) at /usr/local/rvm/rubies/jruby-1.7.5/lib/ruby/shared/ffi/ffi.rb:69
require at org/jruby/RubyKernel.java:1082
(root) at /usr/local/rvm/rubies/jruby-1.7.5/lib/ruby/shared/ffi.rb:1
require at org/jruby/RubyKernel.java:1082
(root) at /usr/local/rvm/rubies/jruby-1.7.5/lib/ruby/shared/ffi.rb:1
require at org/jruby/RubyKernel.java:1082
@cadwallion
cadwallion / course.rb
Last active December 25, 2015 06:58
Coursify examples
class Course < ActiveRecord::Base
include Coursify::Publishable
include Coursify::Enrollable
enrollable_by :user
has_many :lessons
end
@cadwallion
cadwallion / gist:6072305
Created July 24, 2013 16:49
Nodejs app behind nginx
upstream nodejs_app {
server 127.0.0.1:8000; # change this to wherever Express is running
}
server {
listen 80;
server_name mlu.es;
location / {
try_files $uri @nodejs_app;
module Maestro
class Bootstrap
attr_reader :project_name, :org_name, :app_type
def initialize project_name, org_name, options = {}
@project_name = project_name
@org_name = org_name
@app_type = options[:type]
end
@cadwallion
cadwallion / gist:4075054
Created November 14, 2012 21:45
That's a lot of packages...
cadwallion@mediabox:~/Python-2.7.3$ sudo apt-get remove python
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libgfortran3 libtidy-0.99-0 libblas3gf liblapack3gf
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
aisleriot alacarte apport apport-gtk apt-xapian-index aptdaemon apturl apturl-common at-spi brasero brasero-common byobu capplets-data checkbox checkbox-gtk command-not-found compiz
compiz-fusion-plugins-main compiz-gnome computer-janitor computer-janitor-gtk desktopcouch empathy empathy-common eog evince evolution evolution-couchdb evolution-data-server evolution-exchange