Skip to content

Instantly share code, notes, and snippets.

View aprilandjan's full-sized avatar
👻
wandering

May aprilandjan

👻
wandering
View GitHub Profile
@solodxg
solodxg / constellation.js
Created December 18, 2012 03:21
js:生日转换为星座
/**
/* 生日转换为星座
/* @param mon 月份
/* @param day 日份(1-31)
/* @return string 对应日期生日的星座字符串
**/
function constellation(mon, day) {
var s = "魔羯水瓶双鱼牡羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯";
@dosentmatter
dosentmatter / index.js
Created August 29, 2019 18:14
`antd` `@ant-design/icons` cherry-pick
// Affix
// Alert
export { default as CheckCircleOutline } from '@ant-design/icons/lib/outline/CheckCircleOutline';
export { default as CloseCircleOutline } from '@ant-design/icons/lib/outline/CloseCircleOutline';
export { default as CloseOutline } from '@ant-design/icons/lib/outline/CloseOutline';
export { default as ExclamationCircleOutline } from '@ant-design/icons/lib/outline/ExclamationCircleOutline';
export { default as InfoCircleOutline } from '@ant-design/icons/lib/outline/InfoCircleOutline';
// Avatar
@joshuajnoble
joshuajnoble / binding.gyp
Last active September 23, 2020 04:01
Install "node-gyp", compile with "node-gyp configure build", voila.
{
"targets": [
{
"target_name": "keypress",
"conditions": [
['OS == "mac"', {
'include_dirs': [
'System/Library/Frameworks/CoreFoundation.Framework/Headers',
'System/Library/Frameworks/Carbon.Framework/Headers',
],
@deejayy
deejayy / CustomModuleLoader.ts
Last active September 21, 2022 20:26
Solves the problem with typescript->javascript compilation and module path aliases (compilerOptions.paths).
import customModuleLoader = require('module');
export class CustomModuleLoader {
public cOptions: any = require('../tsconfig.json').compilerOptions;
public replacePaths: any = {};
constructor() {
Object.keys(this.cOptions.paths).forEach(alias => {
this.replacePaths[alias.replace(/\*.?/, '(.*)')] = this.cOptions.paths[alias][0].replace(/\*.?/, '$1');
@ufologist
ufologist / autoplay-audio-ios.html
Created December 3, 2015 03:55
在 iOS 微信浏览器中自动播放 HTML5 audio(音乐) 的正确方式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Auto play html audio in iOS WeChat InAppBrowser the right way</title>
</head>
<body>
<h1>在 iOS 微信浏览器中自动播放 HTML5 audio(音乐) 的正确方式</h1>
<p>核心原理: 在微信的JS-API 中 play 一下 audio 即可达到自动播放的目的(应该是微信自己做了处理)</p>
@tzutalin
tzutalin / timer-c++03.cpp
Last active March 11, 2023 12:25 — forked from gongzhitaao/CppTimer.md
Simple high resolution timer in C++
#include <iostream>
#include <ctime>
class Timer
{
public:
Timer() { clock_gettime(CLOCK_REALTIME, &beg_); }
double elapsed() {
clock_gettime(CLOCK_REALTIME, &end_);
@masuidrive
masuidrive / gist:5231110
Created March 24, 2013 08:45
clang options
OVERVIEW: LLVM 'Clang' Compiler: http://clang.llvm.org
USAGE: clang -cc1 [options] <inputs>
OPTIONS:
-### Print the commands to run for this compilation
--analyze Run the static analyzer
--migrate Run the migrator
--relocatable-pch Build a relocatable precompiled header
--serialize-diagnostics <value>
@pazdera
pazdera / gist:1098119
Created July 21, 2011 20:25
Singleton example in C++
/*
* Example of a singleton design pattern.
* Copyright (C) 2011 Radek Pazdera
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
#include <unistd.h>
#include <node.h>
#include <string.h>
#include <v8.h>
using namespace v8;
unsigned long long count = 0;
// native blocking/compute intensive function
@nikita-graf
nikita-graf / decode-electron-crash-reporter-dump.md
Last active September 6, 2023 10:33
How to decode Electron crash dump

Here are steps to decode Electron crashReporter dump on macOS:

  1. Download and install breakpad
  2. Download *-symbols.zip for your Electron release
  3. Setup a simple express app:
const app = require('express')();
const path = require('path');
const fs = require('fs');
const multer = require('multer');