Skip to content

Instantly share code, notes, and snippets.

View mladenp's full-sized avatar

Mladen Petrović mladenp

View GitHub Profile
@mladenp
mladenp / GPScalculateDistance.js
Created May 16, 2017 12:10
Calulate Distance between lat lng points
/* Calculate Distance between two latitute & longitude points */
function GPScalculateDistance(lat1, lng1, lat2, lng2)
{
//radians
lat1 = (lat1 * 2.0 * Math.PI) / 60.0 / 360.0;
lng1 = (lng1 * 2.0 * Math.PI) / 60.0 / 360.0;
lat2 = (lat2 * 2.0 * Math.PI) / 60.0 / 360.0;
lng2 = (lng2 * 2.0 * Math.PI) / 60.0 / 360.0;
@mladenp
mladenp / mac-sierra-tweaks
Created March 15, 2017 16:20
MacOS Sierra Tweaks
Speed Up Mission Control Animations in MacOS Sierra:
defaults write com.apple.dock expose-animation-duration -float 0.1
// and restart Dock with "killall Dock"
// Go back to default speed:
defaults delete com.apple.dock expose-animation-duration; killall Dock
Set Key Repeat:
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
// login/logoff is neded
@mladenp
mladenp / .eslintrc
Created January 31, 2017 13:03 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@mladenp
mladenp / redux-thunk-examples.js
Created January 16, 2017 13:45 — forked from markerikson/redux-thunk-examples.js
Redux-Thunk examples
// The classic AJAX call - dispatch before the request, and after it comes back
function myThunkActionCreator(someValue) {
return (dispatch, getState) => {
dispatch({type : "REQUEST_STARTED"});
myAjaxLib.post("/someEndpoint", {data : someValue})
.then(response => dispatch({type : "REQUEST_SUCCEEDED", payload : response})
.catch(error => dispatch({type : "REQUEST_FAILED", error : error});
};
}
@mladenp
mladenp / git_ls-files
Created December 22, 2016 10:22
Count lines of code in git repo
git ls-files | xargs wc -l
@mladenp
mladenp / webpack.config.js
Created November 8, 2016 10:20
react - webpack hot reload dev server
var webpack = require('webpack');
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'./src/index.js'
],
module: {
loaders: [{
@mladenp
mladenp / .bash_profile
Created November 7, 2016 09:57 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@mladenp
mladenp / webpack.config.js
Created November 5, 2016 00:34
webpack config basic starter
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@mladenp
mladenp / install-brew-manual
Created November 1, 2016 14:55
install homebrew manually
sudo chown -R `whoami`:staff /usr/local
cd ~/src
git clone git://github.com/mxcl/homebrew.git
cd homebrew
git archive --format=tar HEAD|(cd /usr/local;tar xf -)
@mladenp
mladenp / launch_sublime_from_terminal.markdown
Created November 1, 2016 14:19 — forked from artero/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation