Skip to content

Instantly share code, notes, and snippets.

View syuilo's full-sized avatar
🥺

syuilo syuilo

🥺
  • Earth
  • 13:51 (UTC +09:00)
View GitHub Profile
@philfreo
philfreo / localstorage_safari_private_shim.js
Last active November 20, 2019 22:49
Don't let localStorage/sessionStorage setItem throw errors in Safari Private Browsing Mode
// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem
// throw QuotaExceededError. We're going to detect this and just silently drop any calls to setItem
// to avoid the entire page breaking, without having to do a check at each usage of Storage.
if (typeof localStorage === 'object') {
try {
localStorage.setItem('localStorage', 1);
localStorage.removeItem('localStorage');
} catch (e) {
Storage.prototype._setItem = Storage.prototype.setItem;
Storage.prototype.setItem = function() {};
usersA = [ id: 4872, name: 'alice' ]
usersB = [ id: 2849, name: 'bob' ]
users = (usersA ++ usersB) |> sort-by (.id)
console.log users
@AyaMorisawa
AyaMorisawa / lota.md
Created March 23, 2015 04:50
LiveScript Operators Type Annotation

Number

Standard Math

(+) :: Number -> Number -> Number
(-) :: Number -> Number -> Number
@FeodorFitsner
FeodorFitsner / install-redis.com
Created March 26, 2015 19:17
Installing and running Redis as a service
nuget install redis-64 -excludeversion
redis-64\redis-server.exe --service-install
redis-64\redis-server.exe --service-start
@laiso
laiso / gist:bf0037f61b6dae263749
Last active January 24, 2016 07:55
Fwd:【重要】.soドメインの取り扱いについて
━お名前.combyGMO━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━ドメイン公式登録サービス━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━http://www.onamae.com/━
平素は、お名前.comをご利用いただき、まことにありがとうございます。
属性型.soドメインを含む.soドメインについて、ソマリア政府の方針変更に
伴い上位機関及び上位機関での運用方針が変更されることが判明しました。
2015年7月8日に上位機関の変更が行われる予定となり、あわせてドメイン登録
方針が変更され、最終的にソマリア国内のみでの登録受付となる見通しです。
@Integralist
Integralist / flatten-array.js
Created May 20, 2015 08:35
Array flatten function written in ES6 syntax
const flattenTco = ([first, ...rest], accumulator) =>
(first === undefined)
? accumulator
: (Array.isArray(first))
? flattenTco([...first, ...rest])
: flattenTco(rest, accumulator.concat(first))
const flatten = (n) => flattenTco(n, []);
console.log(flatten([[1,[2,[[3]]]],4,[5,[[[6]]]]]))
@telekosmos
telekosmos / uniq.js
Last active November 15, 2022 17:13
Remove duplicates from js array (ES5/ES6)
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
};
var uniqEs6 = (arrArg) => {
return arrArg.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos;
});
@rinsuki
rinsuki / README.md
Last active October 29, 2019 06:49
Misskey API リファレンス(Unofficial)

#Misskey API リファレンス(Unofficial)

##最初に

このAPIリファレンスは非公式だし、書きかけです。
使用する際には自己責任でお願いします。
あとAPIがちゃんと使えるかどうかは確認してません。
Authorizeを除いてパラメータは必須と書いていない物以外はすべて任意です
##参考までに

@paulirish
paulirish / what-forces-layout.md
Last active May 16, 2025 17:21
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@voluntas
voluntas / webrtc.rst
Last active May 16, 2025 00:52
WebRTC コトハジメ