Skip to content

Instantly share code, notes, and snippets.

@elusiveunit
elusiveunit / anki-persistent-data.js
Last active August 29, 2022 22:31
Anki - persistent data between front and back
// Inspired by https://github.com/SimonLammer/anki-persistence
// A much dumber variant to reduce the amount of code on the card.
// Basically just native sessionStorage and a global object
// fallback with a matching API.
window.valueStore = (function (win) {
try {
return win.sessionStorage;
} catch (e) {}
win.vso = win.vso || {};
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
1: 日
2: 一
3: 国
4: 会
5: 人
6: 年
7: 大
8: 十
9: 二
10: 本
@elusiveunit
elusiveunit / firefox-privacy.md
Last active September 7, 2018 16:02 — forked from 0XDE57/config.md
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable.

I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".

@elusiveunit
elusiveunit / esrjl-editor-styles-refresh.php
Last active November 19, 2017 12:28
WordPress editor style cache refresh plugin
<?php
/**
* Plugin Name: Editor Styles Refresh
* Plugin URI: https://gist.github.com/elusiveunit/f0f728771de6647778fa
* Description: Adds file time query string to theme editor style URLs, to force cache busting when the file is changed.
* Author: Jens Lindberg
* Version: 0.1
* License: GPL-2.0+
*/

Using Console2 as a Git Bash wrapper

On Windows 7. Assumed setup, edit .reg file if needed:

  • Git in C:/Program Files (x86)/Git
  • Console2 in C:/Console2
  • A tab in Console2 called 'Git Bash' (-t flag in the .reg file) with the shell C:\Program Files (x86)\Git\bin\sh.exe --login -i

The .reg file adds an item to open a shell in the current directory, just like 'Git Bash Here' from msysgit. console.xml is the Console2 settings file.

@elusiveunit
elusiveunit / focusable-dropdowns.html
Created November 22, 2013 21:07
As implemented on WebPlatform Docs. Makes use of event capturing through the useCapture parameter for addEventListener, so IE9+ or any modern browser. http://docs.webplatform.org/wiki/Main_Page
<p>Let's have a <a href="#before">link before</a></p>
<div class="dropdown">
<a href="#admin">Admin</a>
<ul>
<li><a href="#admin-one">Pages</a></li>
<li><a href="#admin-two">Posts</a></li>
<li><a href="#admin-three">Users</a></li>
<li><a href="#admin-four">Settings</a></li>
</ul>
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
/* some hi-res css */
}
<?php
/**
* Replace the first occurrence in a string.
*
* @param string $search The value being searched for.
* @param string $replace The replacement value.
* @param string $subject The string being searched.
* @return string
*/
function str_replace_first( $search, $replace, $subject ) {
<?php
/**
* Create an array from a hyphenated, newline separated string.
*
* Converts a string like:
*
* Tacos
* Hamburger
* - With cheese
* -- Cheddar