Skip to content

Instantly share code, notes, and snippets.

View QuincyLarson's full-sized avatar
💭
You should follow me on Twitter. I won't waste your time. 😉twitter.com/ossia

Quincy Larson QuincyLarson

💭
You should follow me on Twitter. I won't waste your time. 😉twitter.com/ossia
View GitHub Profile
"Part of what makes programming difficult is most of the time we’re doing stuff we’ve never done before. If it was stuff that had been done before we’d be reusing something else. For most of what we do, we’re doing something that we haven’t done before. And doing things that you haven’t done before is hard. It’s a lot of fun but it’s difficult." - Douglas Crockford (Coders At Work interview)
# To use, put this file, jay.rb, in a directory with the csv files you need to convert.
# Then just run the following command from the prompt:
# ruby jay.rb [name of file without the .csv]
# Get the libraries you need
require 'csv'
require 'json'
# ARGV[0] gets the name of the first argument you passed from the command line - in this case, the name of the csv file
function randomCallback(success, content) {
if (success) {
for (var i = 0; i < content.hits.length; ++i) {
window.location.assign("/?id=" + content.hits[0].id);
}
}
}
$('#random_button').click(function(e) {
var index = client.initIndex('#{Clip.index_name}')
before
var template = Hogan.compile('<div class="hit-auto-complete col-md-12">' +
'<div class="row">' +
'<img class="col-lg-1 col-md-1 col-sm-2 col-xs-2" src="http://ecx.images-amazon.com/images/I/{{{i}}}._SL100_.jpg"</img></td>' +
'<div class="typeahead-product-name col-lg-11 col-md-11 col-sm-10 col-xs-10">{{{_highlightResult.p.value}}}</div>' +
'<div class="typeahead-transcript col-lg-11 col-md-11 col-sm-10 col-xs-10">{{{_highlightResult.t.value}}}</div>' +
'<div class="id" style="display: none;">{{{objectID}}}</div>' +
'</div>' +
'</div>');
@QuincyLarson
QuincyLarson / gist:429fcb33d8adc528f734
Created May 15, 2014 00:07
http://innovation.isotropic.org/play select all the expansions real quick (couldn't get automatch settings to work due to some php weirdness)
document.getElementById("seek_2p").checked = true;
document.getElementById("figures").checked = true;
document.getElementById("echoes").checked = true;
document.getElementById("cities").checked = true;
document.getElementById("extra").checked = true;
source 'https://rubygems.org'
ruby '2.1.2'
gem 'rails', '4.1.5'
gem 'pg'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
def parse_instance(params)
instance = params.delete('instance')
puts '=========='
puts instance
puts '=========='
wixInstance = Hive::Client.parse_instance_data(instance, '371f1483-6a37-402c-a004-91d3d8416923')
return wixInstance.instanceId
end
@QuincyLarson
QuincyLarson / gist:56e5605a7e9525b190f5
Created October 11, 2014 01:17
When asking a question, Quora only gives you a few "Free to Ask" options at a time. This script will load more and then click all the "Free to Ask" buttons for you.
var counter = 1;
function get_people_to_ask() {
if (counter < 10){
counter++
window.setTimeout(foo, 2000);
$('.pager_next_link').click()
}
}
get_people_to_ask();
$( "a:contains('Free to Ask')" ).each(function() { $(this).click(); });
@QuincyLarson
QuincyLarson / gist:b18d7366440af0f37054
Last active August 29, 2015 14:08
Interview Questions for Interview Question Machine
[
{
"question": "Time Complexity of Accessing Array Index (int a = ARR[5];)",
"answer": "O(1)"
},
{
"question": "Time Complexity of Inserting a node in Linked List",
"answer": "O(1)"
},
{
// Sign in with Twitter.
passport.use(
new TwitterStrategy(
secrets.twitter, function(req, accessToken, tokenSecret, profile, done) {
if (req.user) {
User.findOne({ twitter: profile.id }, function(err, existingUser) {
if (err) { return done(err); }
if (existingUser) {
req.flash('errors', {