Skip to content

Instantly share code, notes, and snippets.

@umr55766
umr55766 / calculateColonistCard.js
Last active June 12, 2020 17:46
Colonist : Javascript code to calculate approximate number of cards user have
userData = {
"Kapoor#1292": {
"brick": 0,
"grain": 0,
"lumber": 0,
"ore": 0,
"wool": 0
},
"Nadeem#5285": {
"brick": 0,
@umr55766
umr55766 / citystategeo.js
Last active September 12, 2018 09:15 — forked from danasilver/citystategeo.js
Get city and state from Google Maps API Reverse Geocoder Response
if (window.navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var lat = position.coords.latitude,
lng = position.coords.longitude,
latlng = new google.maps.LatLng(lat, lng),
geocoder = new google.maps.Geocoder();
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
for (var i = 0; i < results.length; i++) {
@umr55766
umr55766 / .git ~ hooks ~ pre-commit
Last active December 14, 2021 03:54
A pre-commit hook to blacked the python code before verfying it with flake8 , this hook only blacken and verify those files which have extension "py" i.e. [*.py] and have been added to stage for committing. Unstaged files and other files are not considered. This hook also abort commit if flake8 throws any message.
#!/bin/sh
# blacken the staged files
for file in $(git diff --cached --name-only | grep -E '\.(py)$')
do
black "$file"
$(git add "$file")
done
for file in $(git diff --cached --name-only | grep -E '\.(py)$')
@umr55766
umr55766 / how to install virtualenv in ubuntu 16 . 04.md
Last active April 16, 2023 15:13 — forked from Geoyi/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv