Skip to content

Instantly share code, notes, and snippets.

@Klerith
Klerith / configurar-node-ts.md
Last active May 5, 2024 21:08
Node con TypeScript - TS-Node-dev simplificado

Node con TypeScript - TS-Node-dev (preferido)

  1. Instalar TypeScript y demás dependencias
npm i -D typescript @types/node ts-node-dev rimraf
  1. Inicializar el archivo de configuración de TypeScript ( Se puede configurar al gusto)
npx tsc --init --outDir dist/ --rootDir src
@jonjaques
jonjaques / bookmarklet.js
Last active May 5, 2024 21:07
jQuery Bookmarklet Template w/ Async Loading
// You create your bookmarklet by instantiating
// a new Bookmarklet function, then pass in the options like so.
// This example checks to see if the var is already defined, and makes
// sure not to overwrite it. This could happen if the user clicks on
// the bookmarklet more than once.
MyBookmarklet = MyBookmarklet || (MyBookmarklet = new Bookmarklet({
// debug: true, // use debug to bust the cache on your resources
css: ['/my/style.css'],
js: [],
@jauderho
jauderho / gist:6b7d42030e264a135450ecc0ba521bd8
Last active May 5, 2024 21:06
HOWTO: Upgrade Raspberry Pi OS from Bullseye to Bookworm
### WARNING: READ CAREFULLY BEFORE ATTEMPTING ###
#
# Officially, this is not recommended. YMMV
# https://www.raspberrypi.com/news/bookworm-the-new-version-of-raspberry-pi-os/
#
# This mostly works if you are on 64bit. You are on your own if you are on 32bit or mixed 64/32bit
#
# Credit to anfractuosity and fgimenezm for figuring out additional details for kernels
#
<!--
Via: http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
-->
<textarea class="js-copytextarea">Hello I'm some text</textarea>
<button class="js-textareacopybtn">Copy Text</button>
<script>
<div data-async='{"script": "javascript/vendor/plugin.js", "event": "scroll"}’>
[ all of the content for this plugin ]
</div>
<?php
$SITEPATH = $_SERVER['DOCUMENT_ROOT'] . '/path/to/dir/';
function get_uri( $image, $mime = '' ) {
return 'data: ' . $mime . ';base64,'.base64_encode(file_get_contents( $image ));
}
?>
var $doc = $(document);
var $yourElement = $('#nav a');
$doc.on('mouseup', function(e) {
if ( ! $yourElement.is(e.target) && $yourElement.has(e.target).length === 0 ) {
// your code here
}
});
<?php
// REF: http://stackoverflow.com/questions/14780804/how-do-i-read-a-google-drive-spreadsheet-in-php
$spreadsheet_url="https://docs.google.com/spreadsheets/d/1MLAko1Eym5O-Qt7cRQb55RBWH3ZHW2_VmHCV0x1Bx5s/pub?gid=0&single=true&output=csv";
$stack = array();
if(!ini_set('default_socket_timeout', 15)) echo "<!-- unable to change socket timeout -->";
UPDATE wp_posts SET guid=replace(guid, 'http://old.url', 'http://new.url');
UPDATE wp_posts SET post_content=replace(post_content, 'http://old.url', 'http://new.url');
/*
// Source: https://madebymike.com.au//writing/service-workers/
<script>
if ( 'serviceWorker' in navigator && ( typeof Cache !== 'undefined' && Cache.prototype.addAll ) ) {
navigator.serviceWorker.register( '/sw.js' );
}
</script>
*/