Skip to content

Instantly share code, notes, and snippets.

@bogdanRada
bogdanRada / custome_time_parser.rb
Last active August 29, 2015 14:07
custom time parser of timestamp
module CustomTimeParser
extend self
def get_time_interval(str_format = '%h:%m:%s', i_seconds=0, options = {})
a_period = {'hour' => 0, 'min' => 0, 'sec' => 0 }
#-- Get the correct period
module BinaryTree
class Node
attr_reader :word, :count
attr_accessor :left, :right
include Enumerable
def initialize(word)
@word = word
@count = 1
require 'rubygems'
require 'mechanize'
require 'net/http'
require 'json'
#get the tmbundle forkers
url = "http://github.com/api/v2/json/repos/show/cucumber/cucumber-tmbundle/network"
cuke_tmbundle_forkers = JSON.parse(Net::HTTP.get_response(URI.parse(url)).body).first[1].map{ |x| x["owner"] }
agent = Mechanize.new
@bogdanRada
bogdanRada / workers.rb
Last active August 29, 2015 14:14 — forked from schmurfy/workers.rb
require 'celluloid'
WORKERS_COUNT = (ARGV[0] || 1).to_i
class Output
include Celluloid
def puts(msg)
Kernel.puts(msg)
end
ANSI_COLOR_CODE = {
0 => 'black',
1 => 'red',
2 => 'green',
3 => 'yellow',
4 => 'blue',
5 => 'purple',
6 => 'cyan',
7 => 'white'
}
@bogdanRada
bogdanRada / Gemfile
Last active August 31, 2015 09:52 — forked from ahaedike/Gemfile
websockets - chat example in HTML template
source "https://rubygems.org"
gem 'eventmachine'
gem 'rubysl-stringio'
gem 'sinatra'
gem 'yajl-ruby', require: 'yajl'
gem 'thin'
gem 'em-websocket', :git=>'https://github.com/igrigorik/em-websocket.git'
@bogdanRada
bogdanRada / olark.php
Last active August 29, 2015 14:15 — forked from iloveitaly/olark.php
<?php
/*
Plugin Name: OLark
Description: Live Chat
Version: 1.0
Author: Michael Bianco
Author URI: http://github.com/iloveitaly/
*/
function admin_page () {
//basic zopim widget code, from their site
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8');
$.src='//v2.zopim.com/?26Smu9lv0NXQEOOg8IAZrMPh9yQstAcV';z.t=+new Date;$.
type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
//make sure zopim does not show till we know we have department agents
var intial_zopim_hiding_done = false;
<!--Start of Zopim Live Chat Script-->
< script type = "text/javascript" >
window.$zopim || (function (d, s) {
var z = $zopim = function (c) {
z._.push(c)
}, $ = z.s =
d.createElement(s),
e = d.getElementsByTagName(s)[0];
z.set = function (o) {
z.set.
@bogdanRada
bogdanRada / zopim_livechat_mixpanel_tracking.js
Last active August 31, 2015 09:46 — forked from fotoflo/gist:10934777
zopim mixpanel tracking.js
//
// Track.js - tracking scripts by alex miller
//
//
config = {};
config.track = true;// set to true in production, false in dev env
config.dump = true;// set to false in production env, true in dev
config.mixpanel = true; // <%= TRACKS_CONFIG['mixpanel'] %>; // set to true in production env, false in dev
config.googleAnaltyics = true;