Skip to content

Instantly share code, notes, and snippets.

View Alynva's full-sized avatar
🤔
Thinking

Alisson Nunes Alynva

🤔
Thinking
View GitHub Profile
@kayhadrin
kayhadrin / js-timeout-polyfill.js
Last active February 28, 2023 17:52
Nashorn setTimeout polyfill
/**
* js-timeout-polyfill
* @see https://blogs.oracle.com/nashorn/entry/setinterval_and_settimeout_javascript_functions
*/
(function (global) {
'use strict';
if (global.setTimeout ||
global.clearTimeout ||
global.setInterval ||
@barbietunnie
barbietunnie / sanitize-filename.js
Created March 12, 2016 07:24
Sanitize a string for use as a filename
/**
* Extracted from node-sanitize (https://github.com/parshap/node-sanitize-filename/blob/master/index.js)
*
* Replaces characters in strings that are illegal/unsafe for filenames.
* Unsafe characters are either removed or replaced by a substitute set
* in the optional `options` object.
*
* Illegal Characters on Various Operating Systems
* / ? < > \ : * | "
* https://kb.acronis.com/content/39790
@jhermann
jhermann / git-commit-emojis.md
Last active September 23, 2023 07:09
Useful emoji for git commit messages

Useful emoji for git commit messages

If you add emoji to your commit messages for a GitHub repo, they become less boring, and you can convey the kind of change you're adding. See the full set of GitHub supported emoji here (also useful for easy copy&paste via a simple click).

Example commit message

The following is a possible scheme to use:

@santthosh
santthosh / apache rewrite rule
Created November 14, 2014 08:38
Apache config for SPA's
# To be inside the /Directory
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
@conorbuck
conorbuck / angle-between-points.js
Created May 5, 2012 22:51
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
@revolunet
revolunet / lzw_encoder.js
Created February 25, 2011 14:55
LZW javascript compress/decompress
// LZW-compress a string
function lzw_encode(s) {
var dict = {};
var data = (s + "").split("");
var out = [];
var currChar;
var phrase = data[0];
var code = 256;
for (var i=1; i<data.length; i++) {
currChar=data[i];