Skip to content

Instantly share code, notes, and snippets.

View aprilandjan's full-sized avatar
👻
wandering

May aprilandjan

👻
wandering
View GitHub Profile
@aprilandjan
aprilandjan / CustomModuleLoader.ts
Created November 10, 2021 08:15 — forked from deejayy/CustomModuleLoader.ts
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');

Travel Guide to OpenGL

I've figured out several things while trying to extend my knowledge of Computer Graphics.

  1. OpenGL can be a bitch if you don't know what you're doing.
  2. There is no worse pain than to experience CMake without knowing what you're doing.
  3. When walking to the depths of hell, it would be nice to have a travel guide.

And that's what this is, a travel guide.

@aprilandjan
aprilandjan / better-nodejs-require-paths.md
Created January 31, 2019 13:49 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@aprilandjan
aprilandjan / multiple_ssh_setting.md
Created January 4, 2019 12:45 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@aprilandjan
aprilandjan / object-to-form-data.js
Created August 29, 2018 08:54 — forked from ghinda/object-to-form-data.js
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
@aprilandjan
aprilandjan / README.md
Created March 19, 2018 10:16 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@aprilandjan
aprilandjan / slugify.js
Last active April 14, 2017 06:54 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().trim().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
// .replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/[^a-zA-Z0-9_\u3400-\u9FBF\s-]/g,'') // remove all non-word & non-chinese chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
}
@aprilandjan
aprilandjan / autoplay-audio-ios.html
Created December 20, 2016 09:08 — forked from ufologist/autoplay-audio-ios.html
在 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>
@aprilandjan
aprilandjan / nginxproxy.md
Created September 12, 2016 04:12 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@aprilandjan
aprilandjan / 1) Install
Created September 10, 2016 19:44 — forked from nghuuphuoc/1) Install
Install Redis on Centos 6
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm