Skip to content

Instantly share code, notes, and snippets.

let g:ScreenImpl = 'Tmux'
let g:ScreenShellTmuxInitArgs = '-2'
let g:ScreenShellInitialFocus = 'shell'
let g:ScreenShellQuitOnVimExit = 0
@yortz
yortz / gist:5867564
Last active December 19, 2015 00:19
defmodule Twitter do
def get_oauth_token
consumer_key= "yourkey"
consumer_secret = "yoursecret"
url = 'https://api.twitter.com/oauth'
consumer = Oauthex.Consumer.new(
key: :erlang.binary_to_list(consumer_key),
secret: :erlang.binary_to_list(consumer_secret)
@yortz
yortz / anagram_test.rb
Created August 13, 2013 11:25
exercism ruby/anagram test
require 'minitest/autorun'
require_relative 'anagram'
class AnagramTest < MiniTest::Unit::TestCase
def test_no_matches
detector = Anagram.new('diaper')
assert_equal [], detector.match(%w(hello world zombies pants))
end
@yortz
yortz / koala.rb
Created July 28, 2015 07:53
koala test
# go to facebook explorer api and get a token, be sure to add user_posts to the app permission!!!
graph_api = Koala::Facebook::API.new("your token in here")
graph_api.get_connections("me", "posts", { limit: 200 } )
@yortz
yortz / gallery_tag.rb
Created February 2, 2016 10:13
gallery tag plugin that integrates lightbox functionality to octopress image gallery
@yortz
yortz / app.js.coffee
Created February 3, 2016 12:58
require fancybox in octopress for octopress gallery plugin
#= require ./libs/jquery-1.9.1
#= require modernizr-2.0
#= require ender
#= require jquery.waitforimages
#= require fancybox/jquery.mousewheel-3.0.6.pack
#= require fancybox/jquery.fancybox.pack
#= require underscore
#= require twitter
#= require gallery
#= require ./libs/lunr.min
@yortz
yortz / useful_queries.rb
Last active September 12, 2019 10:34
Useful queries for stats retrieval
# Total number of users from last month
User.where(last_sign_in_at: 1.month.ago..Date.today).count
User.where(last_sign_in_at: 1.month.ago..Date.today).order(:last_sign_in_at).pluck(:email, :last_sign_in_at)
# Number of users who updated at least one experiment in the last month
Experiment.joins(:user).where(updated_at: 1.month.ago..Date.today).order(:updated_at).pluck(:updated_at, :id, :title, 'users.email').uniq {|r| r.last}.count
Experiment.joins(:user).where(updated_at: 1.month.ago..Date.today).order(:updated_at).pluck(:updated_at, :id, :title, 'users.email').uniq {|r| r.last}
Experiment.joins(:user).where(updated_at: 1.month.ago..Date.today).order(:updated_at).pluck(:updated_at, :id, :title, 'users.email').uniq {|r| r.last}.map {|a| {a.first.strftime("%b-%Y") => { experiment_title: a[2], user_email: a.last } }}
# Number of experiments,grouped by users, created per month for the past 18 months