Skip to content

Instantly share code, notes, and snippets.

ishan ishanbakshi

Block or report user

Report or block ishanbakshi

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
@ishanbakshi
ishanbakshi / SampleExceptionCatching.java
Last active Jul 13, 2016
Sample code to test exception catching in JAVA. This code demonstrates how to build a mapper function to find which user defined exception was thrown.
View SampleExceptionCatching.java
// this code was tested using java ide from tutorials point
// see the running code on http://goo.gl/1pPhqd
import java.lang.*;
public class SampleExceptionCatching{
public static void main(String []args){
try{
System.out.println("Hello World");
@ishanbakshi
ishanbakshi / s3.sh
Created Jul 19, 2016 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
View s3.sh
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@ishanbakshi
ishanbakshi / EnumWithPropertiesExample.java
Last active Jul 28, 2016
This gist demonstrates, how to set/replace default enum properties at runtime.
View EnumWithPropertiesExample.java
// this code was tested using java ide from tutorials point
// see the running code on http://goo.gl/nhXzCc
public class EnumWithPropertiesExample{
public static void main(String []args){
System.out.println("All car prices:");
for (Car c : Car.values()){
System.out.println(c + " costs " + c.getPrice() + " thousand dollars.");
}
@ishanbakshi
ishanbakshi / StaticFunctionExample.java
Created Aug 19, 2016
An example which shows how static functions in java have all the variables act as static within them
View StaticFunctionExample.java
/*
* An example which shows how Static functions can be used in java
* available on Url : http://goo.gl/l2OWUn
*/
public class HelloWorld{
public static void main(String []args){
System.out.println("Start Function");
Student st = new Student();
@ishanbakshi
ishanbakshi / parrotMessengerBot.js
Created Jul 29, 2016
A lambda function that acts like an fb messenger bot which pings back what you typed
View parrotMessengerBot.js
'use strict';
console.log('Loading function');
var https = require('https');
var PAGE_TOKEN = "EAASI6Z**********<fb tokenKey>";
var VERIFY_TOKEN = "my_awesome_token";
/**
* Provide an event that contains the following keys:
*
View guppyTheGroceryBot.js
'use strict';
var https = require('https');
var PAGE_TOKEN = "EAAJ6****";
var VERIFY_TOKEN = "my_token******";
exports.handler = (event, context, callback) => {
// process GET request
if(event.params && event.params.querystring){
var queryParams = event.params.querystring;
var rVerifyToken = queryParams['hub.verify_token']
@ishanbakshi
ishanbakshi / vim.md
Last active May 8, 2018 — forked from vallettea/vim.md
Configure vim on mac
View vim.md

Install pathogen and use a proper directory structure

cd
mkdir -p .vim/{autoload,colors,syntax,plugin,spell,config}
mv .vimrc .vim/vimrc
ln -s .vim/vimrc .vimrc
cd ~/.vim
git clone https://github.com/tpope/vim-pathogen.git pathogen
cd autoload
@ishanbakshi
ishanbakshi / install_ruby_with_rbenv.md
Created Aug 20, 2018 — forked from stonehippo/install_ruby_with_rbenv.md
Installing a new Ruby with rbenv on Mac OS
View install_ruby_with_rbenv.md

Install a new Ruby with rbenv on Mac OS (and make yourself a superhero)

If you're doing stuff with Ruby on a Mac, e.g. installling Jekyll or something, by default you'll end up having to use the sudo command to do stuff, since the permission to modify the default config is not available to your user account.

This sucks and should be avoided. Here's how to fix that.

Installing a new Ruby

To make this better, we are going install a new, custom Ruby. This used to be a big, scary thing, but thanks to the awesome tools Homebrew and rbenv, it's a snap.*

A word of warning: you will have to use Terminal to install this stuff. If you are uncomfortable with text, words, and doing stuff with your computer beyond pointing and hoping, this may not work well for you. But if that's the case, I'm not sure why you were trying to use Ruby in the first place.

@ishanbakshi
ishanbakshi / asyncAwaitCheatsheet.md
Last active Aug 22, 2018
Async/Await cheatsheet
View asyncAwaitCheatsheet.md

(reference : https://tutorialzine.com/2017/07/javascript-async-await-explained)

Async - declares an asynchronous function (async function someName(){...}).

  • Automatically transforms a regular function into a Promise.

  • When called async functions resolve with whatever is returned in their body.

  • Async functions enable the use of await.

@ishanbakshi
ishanbakshi / MySQL_macOS_Sierra.md
Last active Aug 28, 2018 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew
View MySQL_macOS_Sierra.md

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

You can’t perform that action at this time.