Skip to content

Instantly share code, notes, and snippets.

@akanix42
akanix42 / example
Created August 24, 2020 18:47
Bash array expansion as command parameters
#!/usr/bin/env bash
((BASH_VERSINFO > 3)) || {
echo 'Requires Bash 4+'
exit
}
set -ux
echo foo 1 | tail "${tail_args[@]}"
class CartStore {
constructor() {
this.products = [];
}
add(product) {
if (this.products.includes(product)) {
return;
}
@akanix42
akanix42 / 38835949-sample.js
Last active August 10, 2016 16:50
There are a variety of ways to do that; I'd recommend using "classes" (prototypal inheritance) as I think it enhances readability. This sample assumes you are using a version of Meteor new enough to use the ecmascript package (you can do it without ecmascript, it's just not as readable). I'm going to write the example for Meteor 1.3+.
/**
* First, add `api.use('ecmascript');` to your package.js files.
* packages/project:modules-core/package.js:
**/
Package.describe({
name: 'project:modules-core',
summary: 'Core package for Modules.',
version: '1.0.0'
});
@akanix42
akanix42 / gist:5ee6369c38c943c22473
Created February 11, 2016 23:35
rutorrent sort bookmarklet
javascript:$('#List .stable-head td :contains("'+prompt('Column')+'")').mouseup()
// ==UserScript==
// @name Amazon Wishlist Total
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match http://www.amazon.com/gp/registry/wishlist/*
// @copyright 2012+, You
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==