Skip to content

Instantly share code, notes, and snippets.

@armstrongnate
armstrongnate / rbenv 187 mountain lion
Created May 24, 2013 18:00
Install ruby 1.8.7 using rbenv on mountain lion.
Ultimately, this line did the trick:
$ CONFIGURE_OPTS="--without-tk" rbenv install 1.8.7-p370
Additional info:
https://github.com/sstephenson/ruby-build/issues/207
https://github.com/sstephenson/ruby-build/wiki#installing-187-on-os-x-108-mountain-lion
@armstrongnate
armstrongnate / json request objective c
Last active December 17, 2015 10:08
JSON HTTP request in objective-c
NSURL *wiresUrl = [NSURL URLWithString:@"http://blahblah.com.192.168.1.100.xip.io/stuff.json"];
NSData *jsonData = [NSData dataWithContentsOfURL:wiresUrl];
NSError *error = nil;
NSDictionary *dataDictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
@armstrongnate
armstrongnate / install rmagick gem mac
Created May 13, 2013 15:13
Installing rmagick gem can be somewhat of a pain. Here's what ended up doing it for me.
brew update
brew uninstall ImageMagick
brew install ImageMagick
gem uninstall rmagick
gem install rmagick
cd /usr/local/Cellar/imagemagick/6.8.0-10/lib
ln -s libMagick++-Q16.7.dylib libMagick++.dylib
ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib
bundle
@armstrongnate
armstrongnate / typeahead comma
Last active December 16, 2015 22:48
set comma and space on typeahead selection.
message_input.on('typeahead:selected', function(e) {
query = $(this).val();
$(this).typeahead('setQuery', '');
$(this).val(query + ', ');
});
@armstrongnate
armstrongnate / angular-notes
Created April 18, 2013 22:39
Notes about Angular.js
Raw angular app:
Make sure karma is installed
>> npm install -g karma
Clone bare angular app from angular tutorial
>> git clone git://github.com/angular/angular-phonecat.git
>> git checkout -f step-0
Run the server:
How to install node on Ubuntu
>> git clone https://github.com/joyent/node.git
>> cd node/
>> ./configure
>> make
>> sudo make install
Install NPM
@armstrongnate
armstrongnate / dequeue_default_table_view_cell.swift
Created December 11, 2015 23:22
tableView:cellForRowAtIndexPath using UITableViewCell class with preset style
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell: UITableViewCell?
cell = tableView.dequeueReusableCellWithIdentifier(UITableViewCell.wta_reuseableIdentifier())
if cell == nil {
cell = UITableViewCell(style: .Value1, reuseIdentifier: UITableViewCell.wta_reuseableIdentifier())
}
if let result = viewModel?.results.value[indexPath.row] {
ai::Agent::Action * Chan::Program(const ai::Agent::Percept * percept)
{
ai::CCheckers::Action *action = new ai::CCheckers::Action;
ai::CCheckers::MoveData move;
std::string board_str = percept->GetAtom("BASIC_BOARD").GetValue();
ai::CCheckers::BasicBoard board(board_str);
int player = atoi(percept->GetAtom("PLAYER_NUMBER").GetValue().c_str());
//
// UIImage+Blurs.swift
//
// Created by Nate Armstrong on 12/2/15.
// Copyright © 2015 Nate Armstrong. All rights reserved.
//
//
// Compression uses RBResizer: https://gist.github.com/hcatlin/180e81cd961573e3c54d
import Foundation
@armstrongnate
armstrongnate / .docker.env
Created August 31, 2015 00:40
Docker setup for ai
DISPLAY=192.168.0.2:0 # replace `192.168.0.2` with the host machine's local ip