Skip to content

Instantly share code, notes, and snippets.

View spencerdeinum's full-sized avatar

Spencer Deinum spencerdeinum

View GitHub Profile
onRender: function() {
this.$el.find('#units').val(this.model.get('units'));
this.$el.find('#type').val(this.model.get('type'));
this.$el.find('.datepicker').datepicker();
}
@spencerdeinum
spencerdeinum / p.js
Created May 27, 2013 20:59
Backboning
$(function() {
var drugList = new App.DrugList({});
drugList.url = $('#druglist_url').val();
drugList.fetch({
success: function(collection) {
App.list.show(new DrugListView({ collection: collection }));
}
});
});
" Set the font for gvim
if has('gui_running')
" Don't show scroll bars in the GUI
set guioptions-=L
set guioptions-=r
set guioptions-=m
set guioptions-=T
" Set colorscheme for gvim
" colorscheme zen-and-art
colorscheme Tomorrow-Night
@spencerdeinum
spencerdeinum / Main.scala
Last active December 17, 2015 15:29
Jsoup
object Main extends App {
val stream = Source.fromURL("http://www.yahoo.ca")
val document = Jsoup.parse(stream.getLines().mkString)
val title = document.getElementsByTag("title")
println(title)
}
// <title>Yahoo! Canada</title>
@spencerdeinum
spencerdeinum / Main.scala
Created May 23, 2013 02:48
Source.fromURL
object Main extends App {
val stream = Source.fromURL("http://www.yahoo.ca")
val lines = stream.getLines()
stream.getLines().foreach(println)
}
@spencerdeinum
spencerdeinum / life.coffee
Created December 11, 2012 00:07
Conway's game of life
start_game = ->
canvas = document.getElementById "canvas"
context = canvas.getContext "2d"
blockHeight = canvas.height / 10
blockWidth = canvas.width / 10
draw_cell = (x, y, alive) ->
x = x * blockWidth
y = y * blockHeight
if alive
@spencerdeinum
spencerdeinum / artisan.php
Created October 31, 2012 23:12
Detect composer installation in artisan startup
if( ! file_exists( __DIR__.'/vendor/autoload.php' ) )
{
echo "First usage detected, installing composer from getcomposer.org\n";
passthru("php -r \"eval('?>'.file_get_contents('https://getcomposer.org/installer'));\"");
echo passthru("php composer.phar install");
}
@spencerdeinum
spencerdeinum / softdelete.php
Created August 9, 2012 15:27
Soft Delete example for Laravel
<?php
class Softdelete extends HealthieModel
{
protected function query()
{
return new SoftDeleteQuery($this);
}
public function delete()