Skip to content

Instantly share code, notes, and snippets.

View lovubuntu's full-sized avatar
🎯
Focusing

Prabu K lovubuntu

🎯
Focusing
  • https://www.quintype.com
  • Chennai
View GitHub Profile
@lovubuntu
lovubuntu / Deserializer.kt
Created November 24, 2017 08:54
Simple Deserializer for fuel
import com.github.kittinunf.fuel.core.ResponseDeserializable
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.JsonDeserializer
import com.google.gson.reflect.TypeToken
class Block() {
class Deserializer : ResponseDeserializable<Block> {
override fun deserialize(reader: Reader) = Gson().fromJson(reader, Block::class.java)
@lovubuntu
lovubuntu / gist:a5c711a72a26ba6468ef0e89f7a2a5f9
Created August 23, 2017 12:47
colorize and pretty print json in terminal
**Install Pygments**
`pip install pygments`
** Create the following function in bashrc **
```
function jcurl() {
curl "$@" | json | pygmentize -l json
}
```
@lovubuntu
lovubuntu / gist:ce59ec2530f366f178791af65aca7e78
Created August 3, 2017 12:41
Debug voice activated app from GoogleNow
Yes, the app must be published to the Play Store in order for the feature to work.
One way to help debug your end is to trigger the intent via adb,
for example: adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION -e query leela,palace,chennai com.tripadvisor.tripadvisor
brew install go
brew install docker
brew install docker-machine
docker-machine create --driver virtualbox default
eval $(docker-machine env default)
docker build . -t dev/assessment-service
docker-machine ls
docker run -it -p 9000:9000 dev/assessment-service
docker-machine ip default
@lovubuntu
lovubuntu / psql hba conf
Created April 10, 2017 10:36
find postgres hba file
psql -t -P format=unaligned -c 'show hba_file';
@lovubuntu
lovubuntu / jenkins_install.sh
Last active February 9, 2017 19:06
Jenkins install script
wget -q -O — https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c ‘echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list’
sudo apt-get update
sudo apt-get install jenkins
@lovubuntu
lovubuntu / ci setup
Created February 9, 2017 11:21
jenkins setup
# Adding user to sudo list
usermod -aG sudo username
https://www.digitalocean.com/community/tutorials/how-to-create-a-sudo-user-on-ubuntu-quickstart
@lovubuntu
lovubuntu / bo.ot
Created May 18, 2016 07:39
Initial Setup
install brew
brew install zsh --> upgrade to latest version of zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
install agnoster-paradox theme
install powerline fonts if missing
https://raw.githubusercontent.com/skwp/dotfiles/master/iTerm2/Solarized%20Dark.itermcolors

Scope

Lexical Scope

Two forces that can cheat lexical scope:

  1. Eval - By allowing the user to create/modify variables by passing in a string to eval
  2. With - By creating a new variable in the whole new lexical scope (inside the containing function scope)

most of the optimizations the javascript engine does will be pointless if there is eval() or with. So it simply doesn't perform the optimizations at all #long live lexical scope