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.
javascript: document.location.search = (function(param, value, location){ | |
search = location.search; | |
if (search) { | |
pattern = new RegExp('([\?&]?)'+param+'=([^\?&#]*)'); | |
clue = search.match(pattern); | |
if (clue) { | |
search = search.replace(pattern, '$1'+param+'='+value); | |
} else { | |
search += '&'+param+'='+value; | |
} |
javascript: document.location.search = (function(param, value, location){ | |
search = location.search; | |
if (search) { | |
pattern = new RegExp('([\?&]?)'+param+'=([^\?&#]*)'); | |
clue = search.match(pattern); | |
if (clue) { | |
search = search.replace(pattern, '$1'+param+'='+value); | |
} else { | |
search += '&'+param+'='+value; | |
} |
.pt { | |
font-size: 12pt; | |
} | |
.px { | |
font-size: 16px; | |
} | |
.em { | |
font-size: 1em; |
filename = ARGV.first | |
input_array = File.readlines(filename).map(&:to_i) | |
def merge_sort(array) | |
if array.length <=1 | |
return array, 0 | |
else | |
center = (array.length / 2).floor | |
left, left_inv = merge_sort(array[0..center - 1]) |
set googleTabs to {} | |
tell application "Google Chrome" | |
repeat with theWindow in every window | |
repeat with theTab in every tab of theWindow | |
tell theTab | |
if title contains "- Google Search" then | |
set googleTabs to googleTabs & {theTab} | |
end if | |
end tell |
* { | |
color: red; | |
} | |
.vk { | |
color: green !important; | |
} |
$.ajax({ | |
url: 'https://api.schiphol.nl/public-flights/flights', | |
headers: { | |
'ResourceVersion': 'v3', | |
}, | |
dataType: 'json', | |
data: { | |
app_id: window.B.appId, | |
app_key: window.B.appKey, | |
flightdirection: 'D', |
class FlightTable { | |
constructor(domNode) { | |
this.tableNode = $(domNode); | |
this.tableBody = this.tableNode.find('tbody'); | |
} | |
updateFlight(flightDetails) { | |
var rowElement = $(` | |
<tr> | |
<td>${flightDetails.flightName}</td> |
window.B = window.B || {}; | |
window.B.appId = ''; | |
window.B.appKey = ''; |