Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'bundler/setup'
require 'active_model_serializers'
require 'benchmark'
class BadgeType < Struct.new(:id, :name)
include ActiveModel::SerializerSupport
end
class Badge < Struct.new(:id, :name, :badge_type)
package net.vikhyat.circle;
import junit.framework.TestCase;
import org.junit.Before;
import org.junit.Test;
public class CircleTest extends TestCase {
private Circle circle;
@Before
Hummingbird.LibraryEntryView = Ember.View.extend
user: Ember.computed.alias('controller.user')
didInsertElement: ->
@set 'reactComponent', LibraryEntryReactComponent(
content: @get('content')
view: this
)
React.renderComponent @get('reactComponent'), @get('element')
require 'auth/oauth2_authenticator'
class HummingbirdAuthenticator < ::Auth::OAuth2Authenticator
CLIENT_ID = 'removed'
CLIENT_SECRET = 'removed'
def register_middleware(omniauth)
omniauth.provider :hummingbird, CLIENT_ID, CLIENT_SECRET
end
require 'auth/oauth2_authenticator'
class HummingbirdAuthenticator < ::Auth::OAuth2Authenticator
CLIENT_ID = 'removed'
CLIENT_SECRET = 'removed'
def register_middleware(omniauth)
omniauth.provider :hummingbird, CLIENT_ID, CLIENT_SECRET
end
@vikhyat
vikhyat / gist:4433910
Last active December 10, 2015 12:28 — forked from anonymous/gist:4433857
class AgendaTableViewController < UITableViewController
def tableView(tableView, numberOfRowsInSection:section)
return 10
end
def tableView(tableView, cellForRowAtIndexPath:indexPath)
tableView.dequeueReusableCellWithIdentifier('test') ||
UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier:'test')
end
groove_fanatics:boolean
synchronians:boolean
synchronians_group_name:string
charlie_madchap:boolean
charlie_madchap_group_name:string
band_slam:boolean
band_slam_group_name:string
alaap:boolean
instrumania:boolean
instrumania_instrument_name:string
@vikhyat
vikhyat / priority_queue.rb
Created September 20, 2010 10:37
naive priority queue implementation
class PriorityQueue
def initialize
@pq = []
@sorted = true
end
def push(object, priority)
@pq << [ object, priority ]
@sorted = false
end
5 3
7 4
5 3
10 1
7 4
6 2
2 2
2 1
1 1
13 13
@vikhyat
vikhyat / velox.rb
Created April 17, 2010 09:57
Source code for vikhyat.net/stuff/velox/
<html>
<head>
<title>Velox: Random Latin Words</title>
<style type="text/css">
p {
font-family: Georgia,Palatino,Times,'Times New Roman',sans-serif;
}
a:link, a:visited {
color: #f30;
font-size: 75%;