Skip to content

Instantly share code, notes, and snippets.

@alanzhao
alanzhao / java-hector-test
Created March 26, 2012 18:35
Java Hector Performance Test
package com.onescreen.conduit.report.cassandra;
import static org.junit.Assert.*;
import org.junit.Test;
import com.onescreen.conduit.report.timer.Timer;
public class CassandraBenchmarkTest {
package com.onescreen.conduit.report.cassandra;
import static org.junit.Assert.*;
import org.junit.Test;
import com.onescreen.conduit.report.timer.Timer;
public class CassandraBenchmarkTest {
require 'rubygems'
require 'time'
require 'cassandra'
start_timer = Time.now.to_i
client = Cassandra.new('reports', '127.0.0.1:9160')
1000000.times do |i|
client.insert(:test2, i.to_s, {i.to_s => "test"})
unless content
download_file_name = Digest::MD5.hexdigest(item[:guid].to_s)
download_path = download(download_file_name, item[:url])
content = OneScreen::Internal::Content.upload({
:file_uri => download_path,
:name => item[:title],
:short_description => item[:short_description],
:long_description => item[:long_description],
:tags => item[:tags],
:content_type => "video",
@alanzhao
alanzhao / sinatra.rb
Created September 27, 2012 00:50
Subscription service
require 'sinatra'
require 'youtube_it'
get '/ytsubscription' do
channels = params[:channels].split(',')
callback = params[:callback]
username = session[:username] # e.g. [email protected]
oauth_type = session[:oauth_type] # e.g. google_oauth2
@alanzhao
alanzhao / subscription.rb
Created September 27, 2012 01:45
subscription service
require 'sinatra'
require 'youtube_it'
get '/ytsubscription' do
uid = params[:uid] # e.g. [email protected]
provider = params[:provider] # e.g. google_oauth2
channels = params[:channels].split(',')
callback = params[:callback]
failure_url = params[:failure_url]
Id Title Description Content File
4975059 Partners.mov Short clip of our partners at OneScreen http://r.onescreen.net/a/1/mf/0/0/2304087/4975059/15214166?validate=61e6fce46120dc623b28ea8d2c56d8f1
import XMonad
myWorkspaces = ["1","2","3","4","5","6","7","8","9"]
myStartupHook :: X ()
myStartupHook = do
spawn "firefox"
spawn "chromium-browser"
spawn "nautilus . --no-desktop"
spawn "mysql-workbench"
<input type="search" id="search_hint" tabIndex=-1 data-hint='<%= error ? '' : raw(search_example_for_type(params[:type])) -%>' value='<%= error ? '' : raw(search_example_for_type(params[:type])) -%>' autocapitalize="off" autocorrect="off"/>
<input type="search" id="search_input" <%=raw params[:type] ? " class=#{params[:type]}" : '' %> onenter="trackClick('SBB'); Spokeo.search(this);" onfocus="Header.focusSearchBar('home')" onblur="Header.blurSearchBar('home')" tabIndex=1 value="<%=h(params[:n] || params[:p] || params[:e] || params[:u] || params[:q]) %>" autocapitalize="off" autocorrect="off" <%=raw 'autocomplete="off"' if params[:type].blank? || params[:type] =='name'-%>/>
<a id="search_submit" class="btn_green_big" href="#" data-click_tracking='SBB' onclick="return Spokeo.search($('search_input'));"><% if !session[:campaign] %>Search<% end %></a>
//version 1
OnboardingModule.nodeView._connectParent = OnboardingModule.nodeView.connectParent;
OnboardingModule.nodeView.connectParent = _.wrap(OnboardingModule.nodeView.connectParent, function(c, event){
alert('before');
OnboardingModule.nodeView._connectParent(event);
alert('after');
});
//version 2