Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.
- Go to
settings
. - Search for
live templates
. - Under the javascript section you should be able to manage your templates.
import java.lang.Math.*; | |
public class Progressbar { | |
private int max; | |
private int current; | |
private String name; | |
private long start; | |
private long lastUpdate; | |
public Progressbar(int max, String name) |
byte[].metaClass.hexdump { int idx, int len -> | |
println ''' +--------------------------------------------------+ | |
| | 0 1 2 3 4 5 6 7 8 9 a b c d e f | | |
| +----------+--------------------------------------------------+------------------+'''.stripMargin() | |
delegate[ idx..<(idx+len) ].with { bfr -> | |
def bytes = bfr.collect { String.format( '%02x', it ) } | |
.collate( 8 ) | |
.collate( 2 ) | |
.collect { a, b -> ( a + [ '' ] + b ).join( ' ' ).padRight( 48, ' ' ) } | |
def ascii = bfr.collect { it > 0x1f && it < 0x7f ? (char)it : '.' } |
#!/bin/sh | |
in_place() { | |
content="$1" | |
file="$2" | |
id="$3" | |
range="/^#${id} START\$/,/^#${id} END\$/" | |
[ -f "$file" ] && [ -n "$(tail -c 1 "$file")" ] && echo >>"$file" | |
{ rm -- "$file" && sed "${range}d" >"$file"; } <"$file" && sed -n "${range}p" >>"$file" <"$content" | |
} | |
in_place "$0" "$HOME/.profile" 'Jump marks .profile' |
#!/bin/sh | |
# $Id: xvfb-run 2027 2004-11-16 14:54:16Z branden $ | |
# This script starts an instance of Xvfb, the "fake" X server, runs a command | |
# with that server available, and kills the X server when done. The return | |
# value of the command becomes the return value of this script, except in cases | |
# where this script encounters an error. | |
# | |
# If anyone is using this to build a Debian package, make sure the package |
<plist version="1.0"> | |
<dict> | |
<key>pings</key> | |
<array /> | |
<key>jingleDocType</key> | |
<string>purchaseSuccess</string> | |
<key>jingleAction</key> | |
<string>purchaseProduct</string> | |
<key>status</key> | |
<integer>0</integer> |
package de.kopis.camel.model; | |
import org.apache.camel.dataformat.bindy.annotation.CsvRecord; | |
import org.apache.camel.dataformat.bindy.annotation.DataField; | |
@CsvRecord(separator = ",") | |
public class CsvBean { | |
@DataField(pos = 1) | |
private String first; | |
@DataField(pos = 2) |
#!/usr/bin/env python | |
import sys | |
import datetime | |
frankierart={ | |
0x01:'Stampit 2003', | |
0x02:'0x02???', | |
0x03:'Frankit', | |
0x05:'Filiale', | |
0x07:'Frankierservice Infopost/Infobrief', | |
0x08:'Premiumadress', |
#!/usr/bin/env ruby | |
require 'yaml' | |
TYPE_TO_KSY = { | |
'uint8_t' => 'u1', | |
'uint16_t' => 'u2', | |
'uint32_t' => 'u4', | |
'uint64_t' => 'u8', |
// ==UserScript== | |
// @name Gist UserScript Install Link | |
// @author Erik Vold | |
// @namespace gistUserScriptInstallLink | |
// @include http://gist.github.com/* | |
// @version 0.1 | |
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html | |
// @datecreated 2010-01-28 | |
// @lastupdated 2010-01-28 | |
// @description This userscript will add an 'Install' link to all userscript files (which end with .user.js by necessity). |