Skip to content

Instantly share code, notes, and snippets.

View thomasv314's full-sized avatar

Thomas Vendetta thomasv314

View GitHub Profile

Hi everyone, I'm Chris Wanstrath.

When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But then I took a few moments and thought, Wait, why? Why me? What am I supposed to say that's interesting? Something about Ruby, perhaps. Maybe the future of it. The future of something, at least. That sounds keynote-y.

@thomasv314
thomasv314 / save.php
Created December 6, 2012 21:30 — forked from acidtib/save.php
<?php
include('lib/crane.php');
$token = "XXXXXXXXXXXXXXXXXXXXXXXX";
$api = "https://api.foursquare.com/v2";
$api_v = "20120321";
$userinfo = file_get_contents("https://api.foursquare.com/v2/users/self?oauth_token=".$token);
$decoded_userinfo = json_decode($userinfo, true);
$name = $decoded_userinfo;
@thomasv314
thomasv314 / gist:4196532
Created December 3, 2012 17:27 — forked from anonymous/gist:4196426
form validator
$(document).ready(function() {
jQuery.validator.addMethod("password", function(value, element) {
var isValid = value.length >= 6 && /\d/.test(value) && /[a-z]/i.test(value);
return isValid;
}, "Password must be at least 8 characters and must contain one number and one character.");
jQuery.validator.addMethod("inUse", function(value, element){
var email_exists = false;
$.ajax({
type: 'POST',
url: "checkEmail",
@thomasv314
thomasv314 / check.js
Created November 19, 2012 15:11 — forked from acidtib/check.js
$(document).ready( function() {
//If state and city match then provide id
$('#postcard_state'),
$('#postcard_city')
.bind('change', function (e) {
if( $('#postcard_state').val() == "Alabama" && $('#postcard_city').val() == "Abbeville city") {
$("#hidden_town_id").html("<input id='postcard_town_id' name='postcard[town_id]' type='hidden' value='1'>");
}
else if( $('#postcard_state').val() == "Alabama" && $('#postcard_city').val() == "Adamsville city") {
$("#hidden_town_id").html("<input id='postcard_town_id' name='postcard[town_id]' type='hidden' value='2'>");
INSERT INTO `facebooks` (`id`, `client_id`, `provider`, `uid`, `oauth_token`, `oauth_expires_at`, `created_at`, `updated_at`)
VALUES
(1, 1, 'facebook', '100004016931051', 'AAAFhSx2lxZCUBAFraQOqpXSWOEKopMChGFpl9PZBTLrbXGDI7V0CDqYtLLlk2cXH4Px90VEGHGWAi3M9LSNmCoZCIkUXgZB6Jxlh7MUTGRGcb8FGBK5A', '2012-10-10 20:00:00', '2012-10-09 21:25:46', '2012-10-10 18:20:37');
@thomasv314
thomasv314 / check.js
Created October 8, 2012 14:09 — forked from acidtib/check.js
// JSON Array of Towns.. In Rails: <%= @towns = Town.all.to_json %>
var TOWNS = [
{ town: "Abbeville city", id: 1 },
{ town: "Adamsville city", id: 2 },
{ town: "Addison Town", id: 3 }
];
$(document).ready(function() {
$('#postcard_city').bind('change', updateStateValue);
@states = State.find(params[:id])
@towns = @states.towns.paginate(:page => params[:page], :per_page => 9).order("town")
@towns.each do |t|
t.postcards.last
t.postcards.count
end
end
@thomasv314
thomasv314 / home.html.erb
Created September 24, 2012 22:20 — forked from anonymous/home.html.erb
frontend_controller.rb
class FrontendController < ApplicationController
layout "frontend"
def home
@services = Service.all
end
end
@thomasv314
thomasv314 / explor.html.erb
Created August 27, 2012 15:59 — forked from acidtib/gist:3489766
explore view
<% @towns.each do |town| %>
<div>
<%= town.town %> -
<%= town.postcards.last.eat %>
</div>
<% end %>
@thomasv314
thomasv314 / gist:3489805
Created August 27, 2012 15:59 — forked from acidtib/gist:3489766
explore view
<% @towns.each do |town| %>
<div>
<%= town.town %>
<% @postcards.each do |postcard| %>
<%= postcard.eat %>
<% end %>