Skip to content

Instantly share code, notes, and snippets.

@vighnesh1987
vighnesh1987 / test.thrift
Last active May 13, 2016 09:55
Bug in Thrift golang generator when you define self-referential maps
struct A {
1: map<i32, A> selfReferentialMap
}
{
"printConfig":{},
"procedure": {
"metadata": {
"name": "EDTC QIP Inspection",
"type": "SWI",
"procedureID": "5013969",
"approvalStatus": "Escalated",
"version": 2,
"authorDate": "2014-10-14T23:44:40Z",
@vighnesh1987
vighnesh1987 / jsbin.related_list.css
Last active August 29, 2015 13:58
Code that replicates Salesforce's Related List settings interface. http://jsbin.com/yadofafe/3/
@vighnesh1987
vighnesh1987 / .bashrc
Created May 7, 2013 01:30
Add this to your ~/.bashrc. Includes useful aliases. Display branch name in commandline prompt message.
#useful stuff for git
export EDITOR='vim -f'
export PAGER='less'
export GIT_CEILING_DIRECTORIES="/home"
function branchname { git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/[\1]/'; }
alias ga='git add'
alias gps='git push'
alias gl='git log'
alias gs='git status'
alias gd='git diff'
@vighnesh1987
vighnesh1987 / view.html
Last active December 12, 2015 05:59
JavaScript redirect while maintaining browser history
<form action="/work" class="button_to" method="get">
<div>
<input class="hidden" id="0cb8e5a380caa173cdf1f3e4f510bb46" type="submit" value="Continue">
</div>
</form>
<!-- Generated JavaScript from CoffeeScript below - might look unfamiliar -->
<script type="text/javascript">
(function() {
jQuery(function() {
@vighnesh1987
vighnesh1987 / form.html
Last active December 12, 2015 00:59
Using namespace option with form_for in Rails
<form accept-charset="UTF-8" action="/verifications/3" class="edit_verification" id="namesp_edit_verification_3" method="post">
<div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="&#x2713;" />
<input name="_method" type="hidden" value="put" />
<input name="authenticity_token" type="hidden" value="F+sWdgPUzIJoNDr7nlKqBzFAdC73SciL3lb8gd6hL0c=" />
</div>
<div class="field">
<label for="namesp_verification_enrichment_id">Enrichment</label><br />
<input id="namesp_verification_enrichment_id" name="verification[enrichment_id]" type="number" value="2" />
</div>
@vighnesh1987
vighnesh1987 / gist:3992814
Created November 1, 2012 09:56
Apache logs for app
[ pid=32526 thr=140043323348800 file=ext/apache2/Hooks.cpp:862 time=2012-11-01 02:43:06.843 ]: Unexpected error in mod_passenger: Cannot spawn application '/mnt/tpot-production/releases/20121031194109': An error occured while spawning the application.
Backtrace:
in 'virtual Passenger::SessionPtr Passenger::ApplicationPool::Client::get(const Passenger::PoolOptions&)' (Client.h:742)
in 'Passenger::SessionPtr Hooks::getSession(const Passenger::PoolOptions&)' (Hooks.cpp:294)
in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:563)
[Thu Nov 01 02:47:41 2012] [notice] caught SIGTERM, shutting down
[Thu Nov 01 02:47:44 2012] [warn] RSA server certificate CommonName (CN) `production.foo.com' does NOT match server name!?
[Thu Nov 01 02:47:44 2012] [warn] RSA server certificate CommonName (CN) `production.foo.com' does NOT match server name!?
[Thu Nov 01 02:47:44 2012] [warn] RSA server certificate CommonName (CN) `production.foo.com' does NOT match server name!?
@vighnesh1987
vighnesh1987 / git_commit_undo_split.sh
Created October 8, 2012 21:00
Work flow for splitting up latest commit into two separate ones
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
$ git reset --soft HEAD^
$ git status
# On branch master
# Changes to be committed:
@vighnesh1987
vighnesh1987 / ssh_config
Created September 30, 2012 22:29
Enter password only once for logging into Corn/Myth by adding this to /etc/ssh_config [Mac] or /etc/ssh/ssh_config [Linux]
# Open new connections to myth/corn, without typing in a password
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r