Skip to content

Instantly share code, notes, and snippets.

Arnab Deka arnab

  • AWS
  • Seattle, USA
Block or report user

Report or block arnab

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
@arnab
arnab / controller.rb
Last active Jun 5, 2018
Allow & test CORS requests in Rails
View controller.rb
before_filter: allow_cors_requests
def allow_cors
headers["Access-Control-Allow-Origin"] = "*"
headers["Access-Control-Allow-Methods"] = %w{GET POST PUT DELETE}.join(",")
headers["Access-Control-Allow-Headers"] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(",")
head(:ok) if request.request_method == "OPTIONS"
# or, render text: ''
# if that's more your style
end
View Travel-2018-July-Alaska-Maa-Deuta.md

July'18: Alaska Itinerary

Thu 7/19

  • Fly SEA-ANC: 9PM - 11:45 PM (3.5 hours)
  • Hotel: Anchorage: Alex Hotel and Suites near the airport

Fri 7/20

@arnab
arnab / README.md
Last active Sep 12, 2017
Install and run riak in a distributed mode on Mac OSX using homebrew
View README.md

Install

  1. brew install riak
  2. cd `brew --prefix riak`
  3. copy the create_cluster.sh script into this dir
  1. run the script
  • chmod u+x create_cluster.sh
  • ./create_cluster.sh
@arnab
arnab / NumberGuess.java
Created Nov 12, 2010
The number guess game in Common Lisp (from Land of Lisp), to compare to the Ruby implementation
View NumberGuess.java
import java.io.Console;
public class NumberGuess {
private int small;
private int big;
private int guess;
private void guess(){
this.guess = nextGuess();
String verdict = System.console().readLine(guess + ": smaller/bigger/start-over? ");
@arnab
arnab / workspace.sh
Created May 27, 2016 — forked from scottsb/casesafe.sh
Create and manage a case-sensitive disk-image on OSX.
View workspace.sh
#!/bin/bash
# ---------------------------------------------------------
# Customizable Settings
# ---------------------------------------------------------
# where to store the sparse-image
WORKSPACE=${HOME}/.workspace.dmg.sparseimage
# location where workspace will be mounted
@arnab
arnab / dynamic-fonts.el
Created Sep 24, 2012
Dynamically adjust fonts in emacs based on screen resolution (Retina vs. Thunderbolt)
View dynamic-fonts.el
;; Gist-ed from in https://github.com/arnab/emacs-starter-kit
(defun fontify-frame (frame)
(interactive)
(if window-system
(progn
(if (> (x-display-pixel-width) 2000)
(set-frame-parameter frame 'font "Inconsolata 19") ;; Cinema Display
(set-frame-parameter frame 'font "Inconsolata 16")))))
View actors.exs
defmodule Player do
def loop(name, other_player, phrase) do
receive do
{:serve} ->
IO.puts "#{name}: serving"
send(other_player, {:play_next, 1})
loop(name, other_player, phrase)
{:play_next, rally_count} ->
:timer.sleep(700)
:random.seed(:os.timestamp())
@arnab
arnab / mac-cd-prank.sh
Created Jan 28, 2016
Prank to play on unlocked co-worker's computers. Inspired by https://twitter.com/RubyLeaders/status/626068854100332544
View mac-cd-prank.sh
cat >> ~/.zshrc
function chpwd {
echo Hodor;
if type say > /dev/null; then
say Hodor;
fi
}
# then Ctrl + D
View weka_svm_classifier.rb
require "java"
require "./lib/weka.jar"
def read_data(filename)
Java::WekaCoreConverters::ConverterUtils::DataSource.new(filename).get_data_set
end
def normalize(data)
puts data.first.to_double_array.inspect
normalizer = Java::WekaFiltersUnsupervisedAttribute::Normalize.new
View feedback.org

Plash App Beta feedback

Download package name and app name should be same. I downloaded NewsAppMagazine and was looking for that after installing. Didn’t find it.

The download should be from plash.in - not a random box.com link

Login screen

Don’t need the “login” word on top of textboxes. The bottom “Login” button is prominent enough call-to-action.

Remember or Remember Me instead of Remember password

Create account screen

Placeholder text should be subtle-r

The date controls in the DOB field are not working. Shows some category dropdown, not dates.

can’t un-specify gender (even though it’s not required)

You can’t perform that action at this time.