Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / command.js
Last active August 29, 2015 14:27
prettify CSS for backtick
(function () {
'use strict';
// cssbeautify
(function(){"use strict";function a(a,b){function s(a){return" "===a||"\n"===a||" "===a||"\r"===a||"\f"===a}function t(a){return"'"===a||'"'===a}function u(a){return h>="a"&&"z">=h||h>="A"&&"Z">=h||h>="0"&&"9">=h||"-_*.:#".indexOf(a)>=0}function v(){var a;for(a=m;a>0;a-=1)g+=c.indent}function w(){g=r(g),p?g+=" {":(g+="\n",v(),g+="{"),"\n"!==i&&(g+="\n"),m+=1}function x(){var a;m-=1,g=r(g),q&&(a=g.charAt(g.length-1),";"!==a&&"{"!==a&&(g+=";")),g+="\n",v(),g+="}",f.push(g),g=""}var c,f,h,i,j,k,l,m,n,o,r,d=0,e=a.length,g="",p=!0,q=!1;for(c=arguments.length>1?b:{},c.indent===void 0&&(c.indent=" "),"string"==typeof c.openbrace&&(p="end-of-line"===c.openbrace),"boolean"==typeof c.autosemicolon&&(q=c.autosemicolon),r=String.prototype.trimRight?function(a){return a.trimRight()}:function(a){return a.replace(/\s+$/,"")},l={Start:0,AtRule:1,Block:2,Selector:3,Ruleset:4,Property:5,Separator:6,Expression:7,URL:8},m=0,k=l.Start,o=!1,f=[],a=a.replace(/\r\n/g,"\n");e>d;)if
@roine
roine / README.md
Last active August 29, 2015 14:27 — forked from JoelBesada/README.md
Backtick - Angular: count watchers

This is an example command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.

Here are the required steps to create a command:

  1. Create a new Gist with a command.js and command.json file, or simply fork this one.

  2. Write your JavaScript in command.js. This will be injected into and executed on the page the user is currently on when they run it.

  3. Add some metadata to the command.json file:

  • name: The name of the command.
@roine
roine / forof.js
Created December 5, 2014 02:00
Notes on ES6
var numbers = ['a', 'b', 'c'];
for(let i of numbers){
console.log(i); // a b c
}
var users = [{
firstname: 'jon',
lastname: 'dem'
},
@roine
roine / matchers.js
Created December 3, 2014 19:27
Jasmine matchers
var matchers = {
toBePromise: function(util){
return {
compare: function(actual){
var result = {}
result.pass = typeof actual === "object" && typeof actual.then === "function";
if(result.pass){
result.message = "Expected var not be a Promise";
}
@roine
roine / plugin.php
Last active August 29, 2015 14:07
wp have a checkbox in option page to be user specific saved
add_action( 'admin_init', 'register_modal_email_settings' );
function register_modal_email_settings()
{
if( !get_option( $user->user_nicename . '_plugin_options' ) ){
register_setting( 'section_email_modal', $user->user_nicename . '_plugin_options', '0' );
}
add_settings_section( 'section_foo', 'Foo settings', 'foo_desc', 'foo' );
add_settings_field( 'bar', 'Bar field', 'bar_option', 'foo', 'section_foo' );
}
@roine
roine / tips.md
Created June 9, 2014 04:12
Angular tips

#Performance

  1. When using $timeout if $scope does not update set false to the third argument to skip the digest. (see angular doc)
  2. Add strictDi when bootstraping, it should throw an error when a function is not annotated. Annotating is important if you need to minify your code. This feature has been introduced in v1.3.0-beta.6 (see ticket, see performance)