Skip to content

Instantly share code, notes, and snippets.

View codabrink's full-sized avatar

Dakota Brink codabrink

View GitHub Profile
def create
o = request.env["omniauth.auth"]
#render :text => o.to_yaml;return;
authentication = Authentication.find_by_provider_and_uid(o['provider'],o['uid'])
if authentication && authentication.user
authentication.token = o['credentials']['token']
authentication.save
sign_in authentication.user
redirect_to '/profile'
return
<!DOCTYPE html>
<html>
<head>
<title>Device Properties Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="songmint.min.css" rel="stylesheet" type="text/css" />
<link href="jquery.mobile.structure-1.0.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="phonegap-1.2.0.js"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
Viatask - Run your errands, Socially!
</title>
<link href="/assets/application.css" media="screen" rel=
"stylesheet" type="text/css" />
/* line 1, /srv/rails/viatask/app/assets/stylesheets/home.css.scss */
body.home {
background: #6ed3fb;
/* Old browsers */
background: -moz-linear-gradient(left, #6ed3fb 0%, #9de4fc 50%, #6ed3fb 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%, #6ed3fb), color-stop(50%, #9de4fc), color-stop(100%, #6ed3fb));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #6ed3fb 0%, #9de4fc 50%, #6ed3fb 100%);
/* Chrome10+,Safari5.1+ */
<script type="text/javascript" charset="utf-8">
$('#nearbyeventspage').live('pageshow', function() {
navigator.geolocation.getCurrentPosition(onSuccess, onError);
function onSuccess(position) {
nearby_event_url = "http://songmint.net/nearby_events.json/?latitude=" + position.coords.latitude + "&longitude=" + position.coords.longitude;
$.getJSON(nearby_event_url, function(data) {
if(data.length == 0) {
alert("nothing was found");
$("#nearbyeventspage div[data-role=content]").html("nothing was found");
} else {
(function( $ ){
$.fn.scrollable = function() {
$(this).mousewheel(function(event, delta, deltaX, deltaY) {
if (deltaY < 0) {
if ($(this).position().top + $(this).height() > $(window).height()) {
$(this).stop();
$(this).animate({
top: '+=' + deltaY * 82
}, 0);
} else {
require 'minitest/autorun'
class TestRover < MiniTest::Unit::TestCase
def test_rover_operation
@plateau = Plateau.new(5,5)
@plateau.add_rover(1, 2, 'N')
result = @plateau.direct_rover("LMLMLMLMM")
assert_equal result, '1 3 N'
class Plateau
def initialize(height, width)
@rovers = []
$width = width
$height = height
end
def add_rover(x, y, h)
@rovers << Rover.new(x, y, h)
@codabrink
codabrink / gist:1309503
Created October 24, 2011 16:55
NMLParse.rb
require "rexml/document"
require "NMLParse/song"
class NMLParse
attr_accessor :songs
def initialize
@songs = []
end
#This solution is only an example and doesn't have to be concrete. Caleb can change it to how he wants it to function, and he can play around with additional functionality if he likes. =)
print "Hello, what's your name?\n"
name = gets.downcase.chomp
#Adding .downcase to the gets function turns "MoM" into "mom" for example.
#When you press enter upon entering your name it adds a special character to the end called a "newline" character.
#A newline character looks like this: \n
#We don't need this invisible character, so we remove it with the .chomp method.