Skip to content

Instantly share code, notes, and snippets.

View gianlucacandiotti's full-sized avatar

Gianluca Candiotti gianlucacandiotti

  • Wolt
  • Helsinki, Finland
View GitHub Profile
shouldComponentUpdate(nextProps, nextState) {
console.log('props')
console.log(this.props);
console.log(nextProps);
console.log(this.props === nextProps);
console.log('state')
console.log(this.state);
console.log(nextState);
import { round10 } from 'round10';
export function formatMaxDataUnit(quantity, currentUnit = 'Bytes') {
if (quantity < 1024) {
return `${round10(quantity, -2)} ${currentUnit}`;
}
const nextUnit = {
Bytes: 'KB',
KB: 'MB',
@gianlucacandiotti
gianlucacandiotti / npm - jquery
Created August 18, 2016 16:47
Little example on how to manage jquery from npm
import jquery from 'jquery';
// IIFE
export default (function(testLib){
testLib(jquery, window, document);
}(function($, w, d){
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"disable_tab_abbreviations_on_auto_complete": false,
"draw_white_space": "all",
"fade_fold_buttons": false,
"font_face": "Operator Mono Book",
"font_options":
@gianlucacandiotti
gianlucacandiotti / global vars in vue component
Created September 18, 2016 00:42
Using global variables inside vue components with the help of mixins and default props.
// html
window.injectors.baseUrl = '<?= urlHelper('') ?>';
// mixins/injectors.js
const injectorsObj = {};
// eslint-disable-next-line no-undef
Object.keys(window.injectors).forEach((injector) => {
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
@gianlucacandiotti
gianlucacandiotti / after.sh
Created November 10, 2016 14:50
Vagrant shell provisioning - Haskell Minimal Installers
#!/bin/bash
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:hvr/ghc
sudo apt-get update
sudo apt-get install -y cabal-install-1.22 ghc-7.10.3
cat >> ~/.bashrc <<EOF
export PATH="\$HOME/.cabal/bin:/opt/cabal/1.22/bin:/opt/ghc/7.10.3/bin:\$PATH"
EOF
export PATH=~/.cabal/bin:/opt/cabal/1.22/bin:/opt/ghc/7.10.3/bin:$PATH
@gianlucacandiotti
gianlucacandiotti / after.sh
Created December 13, 2016 04:51
Vagrant shell provisioning - Yarn
#!/bin/bash
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
@gianlucacandiotti
gianlucacandiotti / Rebase Git .dll
Created December 17, 2016 22:51
Git bash will close immediately because of cygwin's heap win32 error.
// From this answer on Stack Overflow
// http://stackoverflow.com/questions/18502999/git-extensions-win32-error-487-couldnt-reserve-space-for-cygwins-heap-win32
C:\Program Files (x86)\Git\bin>rebase.exe -b 0x50000000 msys-1.0.dll
@gianlucacandiotti
gianlucacandiotti / after.sh
Last active February 9, 2017 16:26
Vagrant shell provisioning - Mongo DB
#!/bin/bash
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org