Skip to content

Instantly share code, notes, and snippets.

Shakhal Levinson shakhal

Block or report user

Report or block shakhal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
shakhal / switcher.js
Last active Aug 29, 2015
Cytoscape js layout switcher
View switcher.js
$(function(){ // on dom ready
var html = layouts.reduce(function(a,e,i){return a+"<a onclick='setLayout("+i+")'>"+e+"</a> - "},"Layouts:")
}); // on dom ready
var layouts = [ 'concentric',
View call_jsonp.js
function callJsonp(url, callbackFunc){
var callbackName;
if (callbackFunc == null || callbackFunc.length == 0){
callbackName = "dummy";
else if (typeof(callbackFunc) == "function"){
callbackName = functionName(callbackFunc);
if (window[callbackName] == undefined){
callbackName = 'jsonp_callback_' + Math.floor(Math.random() * 100000);
shakhal / quartrer.js
Created Jan 21, 2015
Yearly Quarters math, add, subtract, increase etc...
View quartrer.js
var Quarter = function(year, quarter){
this.year = year;
this.quarter = quarter;
this.str = function(){
return this.year+"_"+this.quarter;
this.increase = function(){
shakhal / toggleCheckbox
Created Apr 9, 2015
Toggle all checkboxes in column of HTML table by TH header checkbox
View toggleCheckbox
$("th input[type='checkbox']").on("click",function(){
var col = $(this).parent().children().index($(this));
var checked = $(this).is(":checked");
$(this).closest("table").find("tr td:nth-child("+col+") input[type=checkbox]").prop("checked", checked);
shakhal / location.php
Created Nov 26, 2015
Extracting Your Own Location Information From Google
View location.php
// Today's time is needed to get the bounding for the request
$currentTime = time();
// Beginning and end of the day
$startTime = strtotime("midnight", $currentTime);
$endTime = strtotime("tomorrow", $startTime);
$smon = date("m", $startTime)-1;
$sday = date("d", $startTime);
$syear = date("Y", $startTime);
if [ -z "$1" ]; then
echo "missing org name"
exit 1
if [ -z "$2" ]; then
shakhal / find_values.js
Last active Dec 13, 2019
Find values in JSON by key, recursively
View find_values.js
function findValues(obj, key){
return findValuesHelper(obj, key, []);
function findValuesHelper(obj, key, list) {
if (!obj) return list;
if (obj instanceof Array) {
for (var i in obj) {
list = list.concat(findValuesHelper(obj[i], key, []));
You can’t perform that action at this time.