Skip to content

Instantly share code, notes, and snippets.

@vshank77
vshank77 / Remove a commit
Last active October 25, 2015 22:51
git filter branch
git filter-branch --commit-filter '
if [ "$GIT_COMMIT" = "FULL_SHA" ];
then
skip_commit "$@";
else
git commit-tree "$@";
fi' HEAD
@vshank77
vshank77 / GsonSerializerTest.java
Created May 13, 2015 14:44
Serialize ImmutableList with GSON
public class JsonSerializerTest {
@Test
public void testGsonInterpret() throws Exception {
Definition expected = Definition.builder().domain("places").traitName("TrainStation")
.desc("london underground").tag("lgu").tag("tube").tag("tfl")
.property(Property.builder("name", StringTraitRef))
.property(Property.builder("age", IntegerTraitRef))
.build();
Gson gson = new GsonBuilder()
@vshank77
vshank77 / deploy.sh
Created February 24, 2015 20:30
Meteor deploy script for Codeship
nvm install 0.10
nvm use 0.10
npm install -g jshint
curl -o meteor_install_script.sh https://install.meteor.com/
chmod +x meteor_install_script.sh
sed -i "s/type sudo >\/dev\/null 2>&1/\ false /g" meteor_install_script.sh
./meteor_install_script.sh
export PATH=$PATH:~/.meteor/
meteor --version
@vshank77
vshank77 / gen.py
Created January 15, 2015 18:59
Twilio Token Generator
import blockspring
from twilio.util import TwilioCapability
def block(request, response):
account_sid = request.params["account_sid"]
auth_token = request.params["auth_token"]
application_sid = request.params["application_sid"]
capability = TwilioCapability(account_sid, auth_token)
@vshank77
vshank77 / index.html
Created January 14, 2015 18:50
Twilio Simple Conference - Unoptimised
<!DOCTYPE html>
<html>
<head>
<title>Sample Conference</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="twilio.css" />
@vshank77
vshank77 / begin.xml
Last active August 29, 2015 14:13
Twilio Simple Conference - TwiML
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>You have joined simple conference room</Say>
<Dial>
<Conference startConferenceOnEnter="true" endConferenceOnExit="true">simple-conference</Conference>
</Dial>
</Response>
@vshank77
vshank77 / TwilioConf.js
Created January 9, 2015 16:00
Javascript Twilio as a String
String header_val = "<!DOCTYPE html>\n<html>\n" +
" <head>\n" +
" <title>Hello Client Monkey 6</title>\n" +
" <script type=\"text/javascript\"\n src=\"//static.twilio.com/libs/twiliojs/1.2/twilio.min.js\"></script>\n" +
" <script type=\"text/javascript\"\n src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js\"></script>\n" +
" <link href=\"http://static0.twilio.com/packages/quickstart/client.css\" type=\"text/css\" rel=\"stylesheet\" />\n" +
" <script type=\"text/javascript\">\n" +
" Twilio.Device.setup(\"" + token + "\");\n" +
" Twilio.Device.ready(function (device) {\n" +
" $(\"#log\").text(\"Client '" + client_name + "' is ready\");\n" +
@vshank77
vshank77 / FunClassTest.java
Created December 4, 2014 12:14
Stupid Compiler Optimization
package serpentes.testing;
import org.testng.annotations.Test;
import java.lang.reflect.Field;
import static org.testng.Assert.assertEquals;
public class FunClassTest {
import com.google.common.collect.ImmutableMap;
import javax.tools.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@vshank77
vshank77 / MapContext.java
Created August 28, 2014 10:52
Map Objects
package igloo.viper.api;
import com.google.common.collect.ImmutableMap;
import lombok.RequiredArgsConstructor;
import java.util.Collections;
import java.util.Map;
@RequiredArgsConstructor
public final class MapContext {