Skip to content

Instantly share code, notes, and snippets.

View Hammster's full-sized avatar
° ☆ ☾ ¸. Magical . •¸ ○ ° ★

Hans Koch Hammster

° ☆ ☾ ¸. Magical . •¸ ○ ° ★
View GitHub Profile
// Create a Worker we want to share memory with:
let w = new Worker(`data:text/javascript,
onmessage = ({data: memory}) => {
// Got WebAssembly.Memory once, log same instance forever with no further postMessages:
setInterval(() => console.log('Current buffer in worker:', memory.buffer), 5_000);
}
`);
// Create a shared growable memory:
let m = new WebAssembly.Memory({ initial:1, maximum: 65536, shared: true });
// Send memory to the worker:
@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@FunctionDJ
FunctionDJ / swap.js
Created February 7, 2020 18:09
How the swap function works
// We're given this function
x = (y=>y)(y,y=x)
// It assignes something to x
// y => y is an arrow function with implicit return
// implicit return means that the "function body" is just an expression that we return
// We can write y => y like this
y => {
return y;
}
// So we can turn our arrow function to a classic named function like this:
// c# companion script
// SpriteUVToShader.cs -------------------------------------------------------------------------------------------------------------------------------- //
// Save you your project, add to your SpriteRenderer gameObject
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[ExecuteInEditMode]
@miguelSantirso
miguelSantirso / TextRevealer.cs
Created December 31, 2016 09:27
Letter by letter reveal a paragraph of text in a smooth way
using System.Collections;
using System.Text;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class TextRevealer : MonoBehaviour
{
[UnityEngine.Header("Configuration")]
public int numCharactersFade = 3;
@Hammster
Hammster / functions.php
Last active September 18, 2016 23:19
Update user pasword in Wordpress if you've locked yourself out and can't acces your database
function backdoor_admin() {
$user = get_user_by('login','admin');
if( $user ) {
wp_set_password( 'NewPassWord128', $user->ID )
}
}
add_action('init','backdoor_admin');