Skip to content

Instantly share code, notes, and snippets.

View StephanieSunshine's full-sized avatar

Stephanie Sunshine StephanieSunshine

  • Prisma Digital Technologies
  • Pacific Northwest, United States
View GitHub Profile
@StephanieSunshine
StephanieSunshine / gist:8c729d96d056f3383872
Created July 9, 2014 00:58
Openshift Ruby Sinatra Mongo / Mongomapper Example / Skeleton
# This can easily be snapped into the Openshift Sinatra Quickstart to drop the information from a HTML Form Post into Mongodb.
# You do need to have the Mongodb cartridge installed for this to work correctly.
require 'sinatra'
require 'mongo_mapper'
require 'json'
class User
include MongoMapper::Document
key :firstName, String
@StephanieSunshine
StephanieSunshine / gist:aa7b5d332faa26a034d4
Last active August 29, 2015 14:04
games.liquid from a locomotivecms build
---
title: Games
slug: games
listed: false
published: true
cache_strategy: none
response_type: text/html
position: 102
---
{% extends parent %}
@StephanieSunshine
StephanieSunshine / Gemfile
Last active August 29, 2015 14:04
docker locomotivecms engine Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.16'
gem 'locomotive_cms', '~> 2', :require => 'locomotive/engine'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'compass-rails', '~> 1.1.3'
gem 'sass-rails', '~> 3.2.3'
@StephanieSunshine
StephanieSunshine / runme.sh
Created August 5, 2014 06:35
LocomotiveCMS / Docker startup script
#!/bin/bash
/usr/bin/mongod --fork --syslog
cd /data/rails/locomotivecms/
@StephanieSunshine
StephanieSunshine / start_engine
Last active August 29, 2015 14:04
LocomotiveCMS / Docker startup script
#!/bin/bash
/usr/bin/mongod --fork --syslog
cd /data/rails/locomotivecms/
source /etc/profile.d/rvm.sh
bundle exec unicorn_rails -D
@StephanieSunshine
StephanieSunshine / gist:2d8918d991491003e555
Created September 23, 2014 08:39
Steps to build plug many locomotives into one mongo
docker run -d --name mongodb dockerfile/mongodb mongod --noprealloc --smallfiles --rest --httpinterface
# use nsenter to enter it and find it's ip using 'ip addr'
### For future notes
### docker run -p 127.0.0.01:804:80 --link=mongodb:27017 --link=mongodb:28017 -d -e MONGODB_PORT_27017_TCP_ADDR="172.17.0.2" metakungfu/locomotive-cms
docker run -p 127.0.0.01:801:80 --link=mongodb:27017 --link=mongodb:28017 -d metakungfu/locomotive-cms
docker run -p 127.0.0.01:802:80 --link=mongodb:27017 --link=mongodb:28017 -d metakungfu/locomotive-cms
docker run -p 127.0.0.01:803:80 --link=mongodb:27017 --link=mongodb:28017 -d metakungfu/locomotive-cms
@StephanieSunshine
StephanieSunshine / quicksort.rb
Last active August 29, 2015 14:23
A Quicksort in Ruby
#!/usr/bin/env ruby
require 'pp'
#Variables
maxElements = 100
randomLowNumber = -10000
randomHighNumber = 10000
def quickSort( toSort )
@StephanieSunshine
StephanieSunshine / bastardhashing.rb
Created June 17, 2015 20:13
An example of a hash made from just arrays
#!/usr/bin/env ruby
require 'pp'
class BastardHashing
#Two arrays, index is the linking column
def initialize()
@keys = Array.new
@values = Array.new
end
@StephanieSunshine
StephanieSunshine / btree.rb
Created June 17, 2015 20:27
Simple binary tree in Ruby. I did not write this.
#!/usr/bin/env ruby
# Snipped from: http://www.mikeperham.com/2014/11/26/building-a-binary-tree-with-enumerable/
class Node
include Enumerable
attr_accessor :data, :left, :right
def initialize(data)
@data = data
@StephanieSunshine
StephanieSunshine / rtree.rb
Created June 17, 2015 20:38
A very basic rtree based on btree.rb
#!/usr/bin/env ruby
class Node
include Enumerable
attr_accessor :data, :children
def initialize( data )
@data = data
@children = Array.new