Skip to content

Instantly share code, notes, and snippets.

View gist:d88e671cdf43daf9a11042252f59da8c
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\n",
"sources" : [ "" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "" ],
View CDR postgres with index
--Start Time--Time Elapsed--CDR query time(ms)--Events read per Interval--Events Read--Events Processed--Events Sent--CPU Usage--Load Average--
--01/11/18 07:15:50--61--248--24--24--24--23--63.48--0.46 0.15 0.09 4/190 23586
deploy@policy-router-test-server-3:/srv/apps/policy_router/current$ ^C
deploy@policy-router-test-server-3:/srv/apps/policy_router/current$ tail -f tmp/benchmark_2018_01_11_07_1
benchmark_2018_01_11_07_14_49.txt benchmark_2018_01_11_07_17_59.txt
deploy@policy-router-test-server-3:/srv/apps/policy_router/current$ tail -f tmp/benchmark_2018_01_11_07_17_59.txt
--Start Time--Time Elapsed--CDR query time(ms)--Events read per Interval--Events Read--Events Processed--Events Sent--CPU Usage--Load Average--
--01/11/18 07:19:00--61--5018--1846--1846--1846--1845--34.6--1.00 0.52 0.25 2/194 23882
View chat.html.erb
<%= form_tag '#', class: 'chat_form' do %>
<%= text_field_tag ‘message’, id: ‘chat_msg’%>
<%= submit_tag ‘send’%>
<% end %>
<script src='//'></script>
<script type="text/javascript">
var apiKey = <%= OPENTOK_API_KEY %>
// use same session_id and token that we have generated above.
pandurang90 / chats_controller.rb
Last active Mar 21, 2017
opentok session creation
View chats_controller.rb
class ChatsController < ApplicationController
def chat
@session = opentok.create_session
@session_id = @session.session_id
# generate opentok token
@token = session.generate_token
pandurang90 /
Created Jan 25, 2016 — forked from naholyr/
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.


Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
View change_default_message.js
// Change the default message of jquery validation
jQuery.extend(jQuery.validator.messages, {
required: "This field is required.",
remote: "Please fix this field.",
email: "Please enter a valid email address.",
url: "Please enter a valid URL.",
date: "Please enter a valid date.",
dateISO: "Please enter a valid date (ISO).",
number: "Please enter a valid number.",
digits: "Please enter only digits.",
pandurang90 /
Created Oct 12, 2015 — forked from jexchan/
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C ""

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

> Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
View gist:9acd17c6431ad94ea7e7
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDQK9kjyPaSHRZIkH7SwQ4WjMJkUSgKPq2pg8CVZeUreuBE0jotknkO1EmSC5zQDtnJLtUYOt08ckgFN5ucVWrceNhTXwLmXZMbSbZHvU7R6luSXyJ/s6zK6hl6MgqP3Z4wmCtSwuaqABC4PTd3X8Hd3wwjfeQXUT6Onpcz3vUS7SkkhHS1mOJvhW4QcPmD8JNolC9yxue2YAEtEArZWFpIlTSu9J3sMea0nK9C3thP9jRoQRPIh8ATQQRkL5Vqeq061FONAHQrkg7phws86HWnTcLxFeJc+fwAmETvmPk41w2zX2Z/Uu2/hTw1XgBqIr/IUSdHZMQuc9Wh7T0v2uH