Skip to content

Instantly share code, notes, and snippets.

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\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@pandurang90
pandurang90 / CDR postgres with index
Created January 11, 2018 08:55
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
--
^C
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
@pandurang90
pandurang90 / chat.html.erb
Last active March 21, 2017 03:01
opentok.js
<%= form_tag '#', class: 'chat_form' do %>
<%= text_field_tag ‘message’, id: ‘chat_msg’%>
<%= submit_tag ‘send’%>
<% end %>
<script src='//static.opentok.com/v2/js/opentok.min.js'></script>
<script type="text/javascript">
$(document).ready(function(){
var apiKey = <%= OPENTOK_API_KEY %>
// use same session_id and token that we have generated above.
@pandurang90
pandurang90 / chats_controller.rb
Last active March 21, 2017 02:59
opentok session creation
class ChatsController < ApplicationController
def chat
opentok = OpenTok::OpenTok.new OPENTOK_API_KEY, OPENTOK_SECRET_KEY
@session = opentok.create_session
@session_id = @session.session_id
# generate opentok token
@token = session.generate_token
end
end
@pandurang90
pandurang90 / _service.md
Created January 25, 2016 09:12 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@pandurang90
pandurang90 / change_default_message.js
Created December 1, 2015 10:40 — forked from 0xqd/change_default_message.js
jQuery validation cheatsheet
// 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
pandurang90 / multiple_ssh_setting.md
Created October 12, 2015 11:01 — forked from jexchan/multiple_ssh_setting.md
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 "your_email@youremail.com"
@pandurang90
pandurang90 / introrx.md
Last active August 29, 2015 14:20 — forked from staltz/introrx.md

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.

=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDQK9kjyPaSHRZIkH7SwQ4WjMJkUSgKPq2pg8CVZeUreuBE0jotknkO1EmSC5zQDtnJLtUYOt08ckgFN5ucVWrceNhTXwLmXZMbSbZHvU7R6luSXyJ/s6zK6hl6MgqP3Z4wmCtSwuaqABC4PTd3X8Hd3wwjfeQXUT6Onpcz3vUS7SkkhHS1mOJvhW4QcPmD8JNolC9yxue2YAEtEArZWFpIlTSu9J3sMea0nK9C3thP9jRoQRPIh8ATQQRkL5Vqeq061FONAHQrkg7phws86HWnTcLxFeJc+fwAmETvmPk41w2zX2Z/Uu2/hTw1XgBqIr/IUSdHZMQuc9Wh7T0v2uH pandurang.plw@gmail.com