Skip to content

Instantly share code, notes, and snippets.

View hyrious's full-sized avatar
💤
lazy

hyrious hyrious

💤
lazy
View GitHub Profile
@Youka
Youka / fiddle_test.rb
Created December 30, 2014 13:21
Simple use of ruby's fiddle library for windows messageboxes
# Load importer part of fiddle (ffi) library
require 'fiddle/import'
# Create module as body for an importer instance
module MessageBox
# Extend this module to an importer
extend Fiddle::Importer
# Load 'user32' dynamic library into this importer
dlload 'user32'
# Set C aliases to this importer for further understanding of function signatures
@westc
westc / limitEval.js
Created March 16, 2016 22:08
Use web workers to limit the amount of time that an eval can run.
function limitEval(code, fnOnStop, opt_timeoutInMS) {
var id = Math.random() + 1,
blob = new Blob(
['onmessage=function(a){a=a.data;postMessage({i:a.i+1});postMessage({r:eval.call(this,a.c),i:a.i})};'],
{ type:'text/javascript' }
),
myWorker = new Worker(URL.createObjectURL(blob));
function onDone() {
URL.revokeObjectURL(blob);
@orzFly
orzFly / rgssruntime.rb
Last active May 11, 2019 09:45
RGSSRuntime Module 1.0 for RPG Maker XP/VX/VX Ace
=begin
RGSSRuntime Module 1.0 for RPG Maker XP/VX/VX Ace
http://orzFly.com/html/rgssruntime.html
Copyright 2013-2014 Yeechan Lu a.k.a. orzFly <i@orzFly.com>
Partial Copyright 2013-2014 Seiran A. [http://seiran.mist.so/]
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@scheakur
scheakur / detectarray.js
Created September 9, 2011 16:43
Check performance of detecting arrays in Rhino
// Original is http://d.hatena.ne.jp/uupaa/20090116/1232051707
var array = [];
var notarray = {};
(function () {
var S = new Date*1;
var toString = Object.prototype.toString;
for (var i = 0; i < 5000000; i++) { ( toString.call(array) === "[object Array]" ) }
print('Array#Object.prototype.toString.call : ' + (new Date-S));
}());
@pascaldekloe
pascaldekloe / utf8.js
Last active September 9, 2023 05:21
JavaScript UTF-8 encoding and decoding with TypedArray
// This is free and unencumbered software released into the public domain.
// Marshals a string to an Uint8Array.
function encodeUTF8(s) {
var i = 0, bytes = new Uint8Array(s.length * 4);
for (var ci = 0; ci != s.length; ci++) {
var c = s.charCodeAt(ci);
if (c < 128) {
bytes[i++] = c;
continue;
@meffie
meffie / Makefile
Last active December 12, 2023 13:26
libyaml examples
all: emit scan parse
emit.o: emit.c
gcc -c emit.c -g -O0 -Wall
emit: emit.o
gcc -o emit emit.o -lyaml
scan.o: scan.c
@phansch
phansch / yardoc_cheatsheet.md
Last active March 1, 2024 18:17 — forked from chetan/yardoc_cheatsheet.md
Improved YARD cheatsheet
@torgeir
torgeir / method-missing-proxy.js
Last active March 11, 2024 01:59
es6 proxies method missing example
/*
What happens?
- `new Type().what` is looked up with a call to `get` on the proxy
- a function is returned that will look up `METHOD_NAME` when called
- `METHOD_NAME` is called because of the `()` behind `new Type().what`
- if `METHOD_NAME` exists on you object, your own function is called
- if not, because of prototypal inheritance, `get` is called again
- `name` is now `METHOD_NAME` and we can throw as we know `METHOD_NAME` is not implemented on the type
credits http://soft.vub.ac.be/~tvcutsem/proxies/
<script>
var module = WebAssembly.instantiateStreaming(fetch("linked_list.wasm"), {});
</script>
@seanh
seanh / html_tags_you_can_use_on_github.md
Last active May 3, 2024 14:57
HTML Tags You Can Use on GitHub

HTML Tags You Can Use on GitHub

Wherever HTML is rendered on GitHub (gists, README files in repos, comments on issues and pull requests, ...) you can use any of the HTML elements that GitHub Flavored Markdown (GFM) provides syntactic sugar for. You can either use the syntactic sugar that GFM (or other GitHub-supported markup language you're using) provides or, since Markdown can contain raw HTML, you can enter the HTML tags manually.

But GitHub also allows you to use a few HTML elements beyond what Markdown provides by entering the tags manually, and some of them are styled with CSS. Most raw HTML tags get stripped before rendering the HTML. Those tags that can be generated by GFM syntactic sugar, plus a few more, are whitelisted. These aren't documented anywhere that I can find. Here's what I've discovered so far:

<details> and <summary>

A `<detai