Skip to content

Instantly share code, notes, and snippets.

@roine
roine / shortcuts.md
Last active July 31, 2017 05:25
My favorite PHPStorm, WebStorm shortcuts on MAC
  • command + option + J, context: html, result: suround with template
  • command + shift + return, context: statement or var declaration, result: add semi colon
  • command + return, context: in fragment context, result: run the fragment, convenient when your database is configured to work with the IDE, command + return will execute the sql query
@roine
roine / Program.elm
Last active April 16, 2017 20:32
bare minimum elm architechure for Elm 0.18
module Main exposing (..)
import Html exposing (..)
-- MODEL
type alias Model =
{ key : Int }
@roine
roine / gist:e40afdd44d7fa421900b81a5917f001c
Created February 28, 2017 17:54
json decode without mapN
https://ellie-app.com/wmXvyWVYqza1/0
@roine
roine / Blocked by IE9
Created November 17, 2016 11:03
Non exhaustive list of features not supported by IE9
- Websocket
- Flexbox
@roine
roine / Confirm.elm
Last active August 22, 2016 16:02
confirm in ELM using Native
module Confirm exposing (confirm)
import Native.Confirm
import Task exposing (Task)
confirm : String -> Task () ()
confirm str =
Native.Confirm.doConfirm str
@roine
roine / bumpversion.sh
Created June 6, 2016 14:48 — forked from pete-otaqui/bumpversion.sh
Bump a software project's VERSION, add the CHANGES, and tag with GIT
#!/bin/bash
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3"
# this script will display the current version, automatically
# suggest a "minor" version update, and ask for input to use
# the suggestion, or a newly entered value.
@roine
roine / controllerSpec.js
Last active May 18, 2016 10:49
Some notes on testing AngularJs with Jasmine and Karma.
describe('controllerCtrl', function () {
var $controller,
$rootScope,
$scope;
beforeEach(module('controller'));
beforeEach(inject(function ($injector) {
$controller = $injector.get('$controller');
$rootScope = $injector.get('$rootScope');
@roine
roine / warn.js
Last active December 26, 2015 07:09
warn the user before to unload the page (closing) and if user agree to stay redirect him
var warn = true;
window.onbeforeunload = function(e){
e = e || window.event;
if(warn){
e.returnMessage = 'yop';
setTimeout(function(){
warn = false;
location.href='http://google.fr';
}, 1);
return 'Are you sure? I got a secret to show you before!';

How can I pass parameters from the command-line?

Whenever you're using alias tasks, you can't pass a flag to aliased tasks. Here are a few patterns to deal with that.

For a global setting available to all tasks, use options:

grunt.registerTask('upload', 'Upload code to deploy', function(n) {
  var target = grunt.option('target');
  // use target var to do something useful
});
@roine
roine / shortcuts
Last active December 25, 2015 18:19
Useful shortcuts in ST2
- CTRL+D, **Select a word and all its occurrence**
- CTRL+SHIFT+D, **Copy paste the current line**
- CTRL+M, **Move the caret to the closest bracket or curly bracket**
- CTRL+SHIFT+M, **Select content into the the closest bracket or curly bracket**
- CTRL+L, **Select the current line**
- CTRL+SHIFT+L, **add a caret at the end of each line selected**
- CTRL+K+K, **Delete all the content on the right of the caret**
- CTRL+SHIFT+K, **Delete the current line**
- CTRL+W, **close the current tab**
- CTRL+SHIFT+G, **Wrap content with a tag, can use zen coding**