Skip to content

Instantly share code, notes, and snippets.

View hmmhmmhm's full-sized avatar
๐Ÿงฏ
BURNING!!

<hmmhmmhm/> hmmhmmhm

๐Ÿงฏ
BURNING!!
View GitHub Profile
@zziuni
zziuni / stuns
Created September 18, 2012 08:05
STUN server list
# source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list
# A list of available STUN server.
stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun01.sipphone.com
stun.ekiga.net
@deepak1556
deepak1556 / webp2png.js
Created December 7, 2013 17:30
webp support using libwebpjs (webp->png in canvas)
WebPDecodeAndDraw = function (data) {
var decoder = new WebPDecoder();
var bitmap = decoder.WebPDecode(data, data.length);
if (bitmap) {
//Draw Image
var output = ctx.createImageData(canvas.width, canvas.height);
var biWidth = canvas.width;
var outputData = output.data;
@nerdyman
nerdyman / resolve-tsconfig-path-to-webpack-alias.js
Last active June 19, 2025 19:38
Convert TypeScript tsconfig paths to webpack alias paths
const { resolve } = require('path');
/**
* Resolve tsconfig.json paths to Webpack aliases
* @param {string} tsconfigPath - Path to tsconfig
* @param {string} webpackConfigBasePath - Path from tsconfig to Webpack config to create absolute aliases
* @return {object} - Webpack alias config
*/
function resolveTsconfigPathsToAlias({
tsconfigPath = './tsconfig.json',
@virolea
virolea / upload.js
Last active December 12, 2024 16:14
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@egoing
egoing / The OAuth 2.0 Authorization Framework: Bearer Token Usage.md
Last active October 11, 2023 03:57
Bearer Authentication ์— ๋Œ€ํ•ด์„œ ์‚ดํŽด๋ด…๋‹ˆ๋‹ค.

์†Œ๊ฐœ

์ด ๊ธ€์€ Oauth๋ฅผ ์ด์šฉํ•ด์„œ access token์„ ํš๋“ํ•œ ํ›„์— api์— ์ ‘์†ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ ์„ค๋ช…ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

์šฐ์„  ๊ณต๋ถ€ํ•ด์•ผ ํ•  ๊ฒƒ๋“ค

์ด ๊ธ€์€ WEB2 OAuth2 ์ˆ˜์—…๊ณผ WEB2 HTTP ์ˆ˜์—…์— ์˜์กดํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. OAuth์™€ HTTP๋ฅผ ์ž˜ ๋ชจ๋ฅด์‹ ๋‹ค๋ฉด ์ด ์ˆ˜์—…๋“ค์„ ๋จผ์ € ๋ณด์‹œ๊ณ  ์ด ๊ธ€์„ ๋ณผ ๊ฒƒ์„ ๊ถŒํ•ด๋“œ๋ฆฝ๋‹ˆ๋‹ค.

Bearer Authentication๋ž€?

API์— ์ ‘์†ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” access token์„ API ์„œ๋ฒ„์— ์ œ์ถœํ•ด์„œ ์ธ์ฆ์„ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ์ธ์ฆ ๋ฐฉ๋ฒ•์ด Bearer Authentication ์ž…๋‹ˆ๋‹ค. ์ด ๋ฐฉ๋ฒ•์€ OAuth๋ฅผ ์œ„ํ•ด์„œ ๊ณ ์•ˆ๋œ ๋ฐฉ๋ฒ•์ด๊ณ , RFC 6750์— ํ‘œ์ค€๋ช…์„ธ์„œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

@Rich-Harris
Rich-Harris / README.md
Last active September 24, 2023 20:08
first-class binding syntax

A modest proposal for a first-class destiny operator equivalent in Svelte components that's also valid JS.

Svelte 2 has a concept of computed properties, which are updated whenever their inputs change. They're powerful, if a little boilerplatey, but there's currently no place for them in Svelte 3.

This means that we have to use functions. Instead of this...

<!-- Svelte 2 -->
<h1>HELLO {NAME}!</h1>
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active July 4, 2025 21:38
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework โ€” unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@Rich-Harris
Rich-Harris / diff.md
Created November 28, 2018 01:32
Concept diff

A concept diff from Svelte 2 to 3

-A component must have a default export, but the default export is not the component
-The default export and its properties must be structured a certain way, you can't just use JavaScript
-Components, actions, animations, transitions, custom events etc must be registered, not just imported
-Components can be registered with a shorthand, because the normal way is cumbersome
-methods are attached to the prototype, and `this` is the component, even though it looks (including to linters and typecheckers) as though the `methods` object itself is the context
-Events must be method calls, not arbitrary expressions
-`event` has a special meaning in method calls, as does `this`, as does `refs`, as do `console` and other special names
@Rich-Harris
Rich-Harris / extensions.md
Last active May 6, 2024 10:29
What should be the canonical file extension for Svelte components?

So far, most of us have been writing Svelte components into .html files, with a few exceptions (Parcel users, for example, have additional constraints to work with). We're currently discussing whether this should change.

Once you've read the pros and cons, please vote!

.html

Pros:

  • It signals that you can use your existing HTML (and CSS) knowledge
  • Valid HTML is valid Svelte
@Alex4386
Alex4386 / babyshark-localize.js
Created February 8, 2019 17:39
Automatic Localization of babyshark song by SmartStudy Inc. via window.navigator.language
/* Written for MintNetwork Yukari Cluster - 500 page handling */
const bs = document.getElementById('babyshark');
/* Localize babyshark */
function localize(langCode) {
const country = window.navigator.userLanguage || window.navigator.language;
let ytCode = "";
const lang = langCode || country.split('-')[0];
switch (lang) {