Skip to content

Instantly share code, notes, and snippets.

@Spoowy
Spoowy / watch_screenshots.sh
Last active November 11, 2019 22:20
Upload screenshots to Google Drive folder and copy url to clipboard
#!/bin/sh
# requires gdrive to work: https://github.com/gdrive-org/gdrive, see also: https://github.com/gdrive-org/gdrive/issues/426
# requires xclip to work
# requires inotifywait to work
path=~/Pictures # local folder where screenshot images are automatically stored
target_folder_id=your_folder_id # target google drive parent folder id
gdrive_path=~/gdrive # gdrive executeable location
@Spoowy
Spoowy / split_list.erl
Created June 28, 2019 21:21
Erlang explode list, split list at delimiter, split list at character or element
-module(split_list.erl).
-export([split_at/2]).
% splits list at delimiter and groups them
% split_list:split_at([hello, '---', ende, '---', okay], '---').
% result: [[hello],[ende],[okay]]
split_at(L, D)-> split_at(L, D, [], []).
split_at([], _, [], G)-> reverse(G);
split_at([], _D, L, G)-> reverse(L) ++ [reverse(G)];
@Spoowy
Spoowy / log.txt
Last active June 7, 2019 20:20
Bluesnap curl log
// passed data
"{"paymentSources":{"creditCardInfo":[{"creditCard":{"expirationYear":"2020","expirationMonth":"01","cardNumber":"4111111111111111","securityCode":"312","cardType":""}}]},"firstName":"Erwin","lastName":"Flaming","shopperCurrency":"USD"}"
// curl getinfo
array(26) {
["url"]=>
string(51) "https://ws.bluesnap.com/services/2/vaulted-shoppers"
["content_type"]=>
string(16) "application/json"
["http_code"]=>
@Spoowy
Spoowy / otp.mk
Created May 15, 2019 13:05
Make file
ifeq ($(OS),Windows_NT)
SEPARATOR=;
else
SEPARATOR=:
endif
MAD := ./mad
VM := vm.args
SYS := sys.config
PLT_NAME := ~/.n2o_dialyzer.plt
@Spoowy
Spoowy / Media Queries for Mobile view
Created March 28, 2019 13:41
Most used CSS queries for mobile view
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
}
// create fake page called "chat-room"
// modify function and variable names with "ABCD" to whatever you like
// modify variable $fakepage_ABCD_url to the fake URL you require
add_filter('the_posts','fakepage_ABCD_detect',-10);
function fakepage_ABCD_detect($posts){
global $wp;
global $wp_query;
global $fakepage_ABCD_detect; // used to stop double loading