Skip to content

Instantly share code, notes, and snippets.

View jagtesh's full-sized avatar

Jag Chadha jagtesh

View GitHub Profile
// creates a graph representation of the input list
function createRelationshipGraph(inputList, idsOnly) {
const graph = {};
inputList.forEach(curNode => {
const { id: curId, parent_id: parentId } = curNode;
const parentDoesNotExist = typeof graph[parentId] === "undefined";
const curDoesNotExist = typeof graph[curId] === "undefined";
const parentIsTopLevel = parentId === null;
@jagtesh
jagtesh / iframeSnippet.html
Created April 14, 2020 21:55 — forked from sperand-io/iframeSnippet.html
Using Segment via iFrame Communication
<script>
/**
* Provides a fake analytics object that sends all calls to the parent window for processing
*/
var analytics = (function() {
var eventQueue = [];
// Send the events to the frame if it's ready.
function flush(method, args) {
while (eventQueue.length) {
@jagtesh
jagtesh / gist:5c726a94f76b9d3c549650ec7bb3173e
Created October 18, 2017 18:57 — forked from oslego/gist:f13e136ffeaa6174289a
create self-signed certificate for localhost
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@jagtesh
jagtesh / phoenix_install.sh
Last active October 21, 2016 18:44 — forked from troygnichols/run phoenix on amazon linux.sh
run phoenix on amazon linux
cd ~
# app deps
sudo yum -y install git
# erlang deps
sudo yum -y groupinstall "Development Tools"
sudo yum -y install ncurses-devel
sudo yum install -y fop
sudo yum install -y openssl-devel
@jagtesh
jagtesh / schema_convert.sh
Created May 20, 2016 15:23 — forked from shantanuo/schema_convert.sh
script to convert mysql schema to be compatible with data warehouse software
#!/bin/sh
# script to convert mysql schema to be compatible with data warehouse software
# make sure that s3cmd and maatkit utility is installed
db_name=${1:-'test'}
> /root/$db_name.txt
temppath='/mnt/data/pdump1'
host='localhost'
user='maatkit'
@jagtesh
jagtesh / arel_patches.rb
Created February 23, 2016 19:07
Arel goodness (with CASE statement) in < v7
# Remove this for Arel v7.0
module Arel
module Nodes
class Case < Arel::Nodes::Node
include Arel::OrderPredications
include Arel::Predications
include Arel::AliasPredication
attr_accessor :case, :conditions, :default
@jagtesh
jagtesh / uninstall_fusion.sh
Created June 25, 2015 20:32
Uninstall / Remove VMware Fusion from OS X
#!/bin/bash
sudo rm -Rf /Applications/VMware\ Fusion.app
sudo rm -Rf /Library/Application\ Support/VMware
sudo rm -Rf /Library/Application\ Support/VMware\ Fusion
sudo rm -Rf /Library/Preferences/VMware\ Fusion
rm -Rf ~/Library/Application\ Support/VMware\ Fusion
rm -Rf ~/Library/Caches/com.vmware.fusion
rm -Rf ~/Library/Preferences/com.vmware.fusion*
@jagtesh
jagtesh / mergepdf
Created June 16, 2015 00:24
High quality pdf merge with Ghostscript
#!/bin/bash
OUT=$1
shift
# Usage: ./mergepdf OUTPUT file1 file2 file3 ...
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$OUT $@
@jagtesh
jagtesh / gist:67e8935f11e413e3b45d
Last active August 29, 2015 14:22 — forked from aaronpowell/gist:9085724
Added the ability to use multiple modules in one file
let module = macro {
case {_
$name
import $params (,) ...
} => {
letstx $name_str = [makeValue(unwrapSyntax(#{$name}), #{here})];
return #{
angular.module($name_str, [$params (,) ...])
};
}

Ace editor component for Ember.

  • A two-way binding is set up between value and the text in the editor.
  • Configure Ace in the aceInit callback.

Template

{{ace-editor value=value aceInit=aceInit class="editor"}}