Skip to content

Instantly share code, notes, and snippets.

View vtambourine's full-sized avatar
🦉

Benjamin T vtambourine

🦉
View GitHub Profile
@vtambourine
vtambourine / url-params-bookmarklet.js
Created January 1, 2012 17:21
Predefined URL parameters bookmarklet
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;
}
@vtambourine
vtambourine / prompt-url-params-bookmarklet.js
Created February 1, 2012 09:41
Prompt URL parameters bookmarklet
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;

intellij javascript live templates

Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.

How to

  • Go to settings.
  • Search for live templates.
  • Under the javascript section you should be able to manage your templates.
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])
@vtambourine
vtambourine / close-google-search-tabs.as
Last active July 15, 2016 14:39
Close all Google Search tabs in all Chrome windows
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
@vtambourine
vtambourine / safari.css
Last active August 4, 2016 20:22
safari.css
* {
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 = '';