Skip to content

Instantly share code, notes, and snippets.

View ielgnaw's full-sized avatar
💭
I may be slow to respond.

ielgnaw ielgnaw

💭
I may be slow to respond.
View GitHub Profile
@tyru
tyru / promise-is-resolved.js
Last active December 4, 2023 02:54
Check whether a promise is finished / resolved / rejected
function delay(msec, value) {
return new Promise(done => window.setTimeout((() => done(value)), msec));
}
function isResolved(promise) {
  return Promise.race([delay(0, false), promise.then(() => true, () => false)]);
}
function isRejected(promise) {
  return Promise.race([delay(0, false), promise.then(() => false, () => true)]);
@Azerothian
Azerothian / jsobjtogql.js
Last active May 1, 2022 04:27
Convert JS Objects to GraphQL Queries
// Babel 2015 - ES6
// Convert a complex JS Object to GraphQL Query, should handle most use cases as of 21/01/2016
const o = {
query: {
fields: {
complex: {
aliasFor: "Products",
processArgs: {
coupon: (value) => {
return `"${JSON.stringify(value).replace(/"/g, "\\\"")}"`; // passing json string as a argument
@davestevens
davestevens / LetsEncrypt.md
Last active March 28, 2024 10:35
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
@muink
muink / Clear-unwanted-URL-on-Chrome-address-bar.md
Created October 28, 2015 07:57
删除Chrome地址栏记录中不需要的网址

删除Chrome地址栏记录中不需要的网址(访问历史)

Chrome的地址栏自动补齐功能提供了非常方便的地址预测功能 浏览器可以通过用户当前输入的字符来与用户的访问历史与书签匹配 然后在下拉栏中为用提供准确的补齐方案排名, 提高用户访问效率

在大部分情况下, 这个功能是非常好用的 但是有时, 出于某些原因, 用户需要移除某个记录(网址无法访问,网址更换域名等) Chrome提供了组合键Shift+Delete来删除地址栏下拉记录中的某个网址

anonymous
anonymous / sublime_text3_crack.md
Created June 7, 2015 04:58
Sublime Text 3092 3083 latest crack Win32 Win64 Linux64 Linux32 OSX Mac MacOS

cat

For pupil: all binary can be downloaded http://pan.baidu.com/s/1hqH2Pko

After overwriting, maybe need to run chmod +x /path/to/sublime_text. For linux default installation, need to add sudo.

For programmer:

VERSION PLATFORM OFFSET ORIGINAL CRACKED
@fdxer
fdxer / sublime_test3.md
Last active August 3, 2019 00:34
Sublime Text 3 latest download
@subchen
subchen / git-stash.md
Created October 31, 2014 08:56
Git Stash 用法

git stash用于保存和恢复工作进度

  • git stash

    保存当前的工作进度。会分别对暂存区和工作区的状态进行保存

  • git stash save "message..."

这条命令实际上是第一条 git stash 命令的完整版

@juanbrujo
juanbrujo / randomColor.less
Created July 9, 2014 02:46
Mixin to generate random color in LESS
.randomColor(){
@randomColor: `Math.floor(Math.random()*16777215).toString(16)`;
@colorHex: e(@randomColor);
@color: ~"#@{colorHex}";
}
// USE
body {
.randomColor();
@leeight
leeight / test.less.js
Created May 8, 2014 03:51
test.less.js
/***************************************************************************
*
* Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved
* $Id$
*
**************************************************************************/
/**