Skip to content

Instantly share code, notes, and snippets.

View underhilllabs's full-sized avatar

Bart Lantz underhilllabs

View GitHub Profile
@underhilllabs
underhilllabs / app.js
Last active August 29, 2015 14:04
scrumple notes
(function() {
var app = angular.module('notebook', []);
app.controller("NotebookController", function() {
this.notes = [
{
id: "note1",
title: 'First Note',
body: 'First Note\nCheck it out!',
classes: "green",
},{
@underhilllabs
underhilllabs / fapi-states.php
Created July 24, 2014 17:39
Drupal 7 form api: Hide a form element if another element is non-blank
<?php
// Only show "save" button if user_id not filled in.
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save for later'),
'#submit' => array('dance_code_codingsheet_form_save'),
'#limit_validation_errors' => array(),
'#states' => array(
'visible' => array(
':input[name="user_id"]' => array('value' => ''),
@underhilllabs
underhilllabs / rspec_examples.md
Last active August 29, 2015 14:04
rspec notes

RSpec Notes

Should Matchers

  • should == '1'
  • should_not == '1'

should include

zombie.should include(tweet)
@underhilllabs
underhilllabs / config.ru
Last active August 29, 2015 14:04
Sinatra Modular Style
# this is how we run our modular app
require "./sinatra_mod_app"
run MyApp
@underhilllabs
underhilllabs / digitalocean_dokku.md
Last active August 29, 2015 14:05
Set up Dokku on a Digital Ocean droplet

This is notes from my first time using Digital Ocean. It is a pretty cool interface and it has a Dokku instance built in. But there were a couple additional steps to set it up, as well as one hiccup with SSH keys.

Create a droplet

My config options

option my choice
hostname dokku
RAM 512MB
@underhilllabs
underhilllabs / hello_flask.py
Last active August 29, 2015 14:05
flask notes
from flask import Flask
# create an instance of the Flask class
app = Flask(__name__)
# create a route with the route decorator
# it binds a route to a function
@app.route('/')
def hello():
print "Hello, from Flask!"
@underhilllabs
underhilllabs / lib-resources.rb
Created August 13, 2014 15:38
which multi-branch statement is more readable in ruby? Roles: instructor, learner, ta. Campus: DDC, AMC. School: 13 departments...
# roles available are: instructor, learner, ta, designer
def lib_url(role, campus, school=nil)
if role == 'instructor'
if campus == 'AMC'
"https://hslibrary.ucdenver.edu/"
elsif campus == 'DDC'
"https://library.auraria.edu/"
end
elsif role == 'learner'
if campus == 'AMC'
@underhilllabs
underhilllabs / build.sh
Last active August 29, 2015 14:05
ionic commands to build and launch app on connected android device
# create demo tabs app
ionic start ionicTabs tabs
cd ionicTabs
ionic platform add android
ionic build android
# install on phone, since android emulator will take 30 minutes to load and then fail
adb install platforms/android/ant-build/ionicTabs-debug.apk
@underhilllabs
underhilllabs / library_urls.rb
Created August 15, 2014 17:21
Library Resources function
# roles available are: instructor, learner, ta, designer
# campus: DDC or AMC
def lib_url(role, campus, level='undergraduate', school=nil)
if campus == 'DDC' && level == 'undergraduate'
case role
when 'instructor'
"http://library.auraria.edu/"
when 'learner'
"http://library.auraria.edu/"
else
@underhilllabs
underhilllabs / app.js
Created September 1, 2014 18:56 — forked from jgoux/app.js
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});