Skip to content

Instantly share code, notes, and snippets.

View mladenp's full-sized avatar

Mladen Petrović mladenp

View GitHub Profile
@mladenp
mladenp / zshrc
Created December 19, 2023 12:04
zsh options
HISTSIZE=5000
HISTFILE=~/.zsh_history
SAVEHIST=5000
HISTDUP=erase
setopt appendhistory
unsetopt inc_append_history
setopt sharehistory
setopt incappendhistory
setopt hist_ignore_all_dups
setopt hist_save_no_dups
@mladenp
mladenp / iterm-color-tab
Created July 4, 2023 15:11
Iterm set random tab color
precmd() {
# sets the tab title to current dir
echo -ne "\e]1;${PWD##*/}\a"
}
PRELINE="\r\033[A"
function random {
echo -e "\033]6;1;bg;red;brightness;$((1 + $RANDOM % 255))\a"$PRELINE
@mladenp
mladenp / inject-jquery.js
Created March 14, 2021 21:20
inject jQuery from browser console
javascript:(function(e,s){e.src=s;e.onload=function(){jQuery.noConflict();console.log('jQuery injected')};document.head.appendChild(e);})(document.createElement('script'),'//code.jquery.com/jquery-latest.min.js')
@mladenp
mladenp / opentiles.yaml
Last active January 27, 2020 23:49
opentiles tangram
import:
- https://tangrams.github.io/blocks/filter/grain.yaml
scene:
background:
color: '#555'
sources:
osm:
type: MVT
@mladenp
mladenp / WebStorm_JS_Code_Scheme.xml
Created August 6, 2019 10:41
WebStorm AirBnB CodeStyle Scheme
<code_scheme name="Airbnb">
<option name="RIGHT_MARGIN" value="100" />
<option name="HTML_ATTRIBUTE_WRAP" value="4" />
<option name="HTML_ELEMENTS_TO_INSERT_NEW_LINE_BEFORE" value="" />
<option name="HTML_ENFORCE_QUOTES" value="true" />
<DBN-PSQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
@mladenp
mladenp / basic.yaml
Created December 20, 2018 00:29
Tangram example point labels
sources:
tz2:
type: GeoJSON
url: https://gist.githubusercontent.com/mladenp/469a49559f566ad46e65281fe0e4f9cb/raw/8f1a3421f299fa014107c49ff6de0f9473281d4b/MultiPolygon.geojson
generate_label_centroids: true
max_zoom: 21
min_zoom: 1
tz3:
type: GeoJSON
@mladenp
mladenp / MultiPolygon.geojson
Last active December 17, 2018 16:10
MultiPolygon GJ
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mladenp
mladenp / gjtest.geojson
Last active December 19, 2018 23:44
Geojson test
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mladenp
mladenp / geojsonexample.geojson
Last active December 17, 2018 15:17
geojson example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mladenp
mladenp / iframe-listener.js
Created October 8, 2018 16:53
iframe URL redirect listener
function iframeURLChange(iframe, callback) {
var unloadHandler = function () {
// Timeout needed because the URL changes immediately after
// the `unload` event is dispatched.
setTimeout(function () {
callback(iframe.contentWindow.location.href);
}, 0);
};
function attachUnload() {