Skip to content

Instantly share code, notes, and snippets.

@radcliff
radcliff / ascii.rb
Created April 8, 2014 01:38
A simple ruby program that prints an ASCII art triangle.
#Simple ASCII Art
puts "What character do you want to make the pyramid out of?"
character = gets.chomp
puts "How many rows of #{character}'s do you want?"
row_count = gets.chomp.to_i
character_count = 1
width = 100
@radcliff
radcliff / muliplication.rb
Created April 8, 2014 17:10
Prints a multiplication table.
# Prints a multiplication table
puts "Please specify the number of rows and colums:"
size = gets.chomp.to_i
if size > 0
puts "A multiplication table:"
puts
@radcliff
radcliff / hangman.html
Created June 3, 2014 22:56
Hangman in AngularJS
<!DOCTYPE html>
<html>
<head>
<script src="http://jashkenas.github.io/underscore/underscore-min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<script src="script.js"></script>
<meta charset="utf-8">
<title>HangMan</title>
</head>
<body ng-app>
@radcliff
radcliff / intro-to-jekyll.md
Created June 15, 2014 23:50
Introduction to Jekyll

Jekyll

Static Websites and Blogs

COOL STUFF
Written in Ruby
Uses Markdown for content generation
Integrates with GitHub Pages

###What is Jekyll?

@radcliff
radcliff / geojson_helper.rb
Last active August 29, 2015 14:04
drought-monitor-api helpers
module GeojsonHelper
# this method takes in a RGeo geometry object and returns a GeoJSON object
def to_geojson(geometry_collection)
geojson_object = {}
geojson_object["type"] = "FeatureCollection"
geojson_object["features"] = []
geometry_collection.each_with_index do |record, index|
@radcliff
radcliff / droughtshapes_controller.rb
Created July 24, 2014 03:22
Ruby method to convert geojson to topojson in Rails API
class DroughtshapesController < ApplicationController
include ApplicationHelper
def index
if params[:s]
state_name = params[:s].split.map {|i| i.capitalize}.join(" ")
state = State.find_by(name: state_name)
if state
shapes = state.drought_shapes
geojson_shapes = to_geojson(shapes)
@radcliff
radcliff / .gitignore
Created January 21, 2015 00:10
One way to work with secrets in Python
credentials.yml
@radcliff
radcliff / array.coffee
Created January 27, 2015 01:35
Object and Array Transforms for Ember-cli in CoffeeScript
`import DS from 'ember-data'`
ArrayTransform = DS.Transform.extend
deserialize: (serialized) ->
if (Ember.typeOf(serialized) is "array") then serialized else []
serialize: (deserialized) ->
type = Ember.typeOf(deserialized)
if type is "array"
deserialized
------------------------------------------------------------------------------------------------------------------------------
DESCRIPTION:
Notes for deploying TileStream on an AWS EC2 Ubuntu 12.04.2 Server for development. Includes workflow for creating
a local tile cache with TileMill, connecting to your Ubuntu EC2 server via SSH using Mac OSX Terminal, and uploading
your tiles (.mbtiles) to your TileStream server.
REFERENCES:
TileStream git repo: https://github.com/mapbox/tilestream
-----------------------------------------------------------------------------------------------------------------------------
# Install Git needed for Git based gems
packages:
yum:
git: []