Skip to content

Instantly share code, notes, and snippets.

View jakub-g's full-sized avatar

jakub-g jakub-g

  • Antibes, France
  • 21:41 (UTC +02:00)
View GitHub Profile
@jakub-g
jakub-g / InstantTemplate.tpl
Last active August 29, 2015 14:07
AT: deprecated widgets used as containers Usage of most of the widgets as "containers" (i.e. {widget}{/widget}) was deprecated. You should switch to the self-closing syntax, i.e. {widget /}
{var counter = 0 /}
{macro main()}
{call tooltipDefinitions() /}
{call writeLinks() /}
{set counter = counter + 1 /} <br>
The main macro was executed ${counter} times.
{/macro}
@jakub-g
jakub-g / InstantTemplate.tpl
Last active August 29, 2015 14:07
AT: misusing setValue
{macro main()}
<button {on click "updateModelBad" /}>Update (bad)</button>
<button {on click "updateModelStillBad" /}>Update (even worse)</button>
<button {on click "updateModelBetter" /}>Update (best)</button>
<br>
Magic value is: {@aria:Text {
bind : {
text : {
inside: this.data.myContainer,
@jakub-g
jakub-g / InstantTemplate.tpl
Last active August 29, 2015 14:07
AT: confusing strings and identifiers 1
{macro main()}
magicValue: {@aria:Text {
bind : {
text : {
inside: this.data,
to: magicValue
}
}
}/}
{/macro}
@jakub-g
jakub-g / InstantTemplate.tpl
Last active August 29, 2015 14:07
AT: Replacing object in data model
{macro main()}
<button {on click "updateModel" /}>Update</button>
<br>
{section {
macro: "printText",
bindRefreshTo : [{
inside: this.data,
to: 'myContainer'
}]
@jakub-g
jakub-g / open-atlassian-stash-pullrequest.sh
Last active February 22, 2017 05:27
Open Atlassian Stash pull request from command line (open browser at the right URL)
#!/bin/bash
##################################################################
# Open Atlassian Stash pull request from command line.
# (opens the default browser at the proper URL with data prefilled)
#
# It infers current branch name, repo name, current user name, from git config.
############################### CONFIG ###########################
URL_PREFIX="http://stash.yourcompany.com"
@jakub-g
jakub-g / cleanEmptyFoldersRecursively.js
Created April 3, 2015 15:31
nodejs: remove empty directories recursively
function cleanEmptyFoldersRecursively(folder) {
var fs = require('fs');
var path = require('path');
var isDir = fs.statSync(folder).isDirectory();
if (!isDir) {
return;
}
var files = fs.readdirSync(folder);
@jakub-g
jakub-g / .profile
Last active September 12, 2022 19:47
npm run Win-compatible bash completion (for custom scripts defined in `package.json`)
#!/bin/bash
alias npmrun='npm run'
alias _npmscripts_print="node -e \"console.log(Object.keys(require('./package.json').scripts, null, ' ').join(' '))\""
_npmscripts_completion()
{
local cur=${COMP_WORDS[COMP_CWORD]}
opts=$( _npmscripts_print )
COMPREPLY=( $(compgen -W "${opts}" -- $cur) )
}
complete -F _npmscripts_completion npmrun
@jakub-g
jakub-g / windows-must-have-tools.md
Last active September 8, 2015 14:51
Windows tools
@jakub-g
jakub-g / _1_"script async defer" blocks "load" event.md
Last active August 22, 2023 10:10
Beware of "script async defer" blocking HTML "load" event

Beware of <script async defer> blocking HTML "load" event

2015.10.07 t

On the importance of simulated latency testing, and bulletproofing your page from the third-party JS load failures

TL;DR