Skip to content

Instantly share code, notes, and snippets.

View ginkosen's full-sized avatar

GinKo ginkosen

View GitHub Profile
@ginkosen
ginkosen / nginx.conf
Created April 11, 2023 09:49 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@ginkosen
ginkosen / nginx-cors.conf
Created April 11, 2023 09:48 — forked from sbuzonas/nginx-cors.conf
Nginx CORS maps
map $http_origin $allow_origin {
default "";
"~^https?://(?:[^/]*\.)?(stevebuzonas\.(?:com|local))(?::[0-9]+)?$" "$http_origin";
}
map $request_method $cors_method {
default "allowed";
"OPTIONS" "preflight";
}
@ginkosen
ginkosen / nginx.conf
Created April 11, 2023 09:47 — forked from slavafomin/nginx.conf
How to enable CORS in nginx with origin matching
server {
listen 80 default_server;
root /var/www;
location / {
set $cors '';
set $cors_allowed_methods 'OPTIONS, HEAD, GET';
if ($http_origin ~ '^https?://(www\.)?example.com$') {
set $cors 'origin_matched';
$fa-var-500px: \f26e;
$fa-var-address-book: \f2b9;
$fa-var-address-book-o: \f2ba;
$fa-var-address-card: \f2bb;
$fa-var-address-card-o: \f2bc;
$fa-var-adjust: \f042;
$fa-var-adn: \f170;
$fa-var-align-center: \f037;
$fa-var-align-justify: \f039;
$fa-var-align-left: \f036;
@ginkosen
ginkosen / Autocomplete.js
Created April 3, 2022 09:06 — forked from mwrouse/Autocomplete.js
Autocompletion for an object in the monaco editor
function ShowAutocompletion(obj) {
// Disable default autocompletion for javascript
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ noLib: true });
// Helper function to return the monaco completion item type of a thing
function getType(thing, isMember) {
isMember = (isMember == undefined) ? (typeof isMember == "boolean") ? isMember : false : false; // Give isMember a default value of false
switch ((typeof thing).toLowerCase()) {
case "object":
@ginkosen
ginkosen / mobile-meta-html5.html
Created April 13, 2021 06:28 — forked from MrUzu/mobile-meta-html5.html
WebApp meta for Icons and Startup screens
<!-- HTML5 DOCTYPE, IMPORTANT -->
<!DOCTYPE html>
<html dir="ltr" lang="en-EN">
<head>
<meta charset="UTF-8" />
<title>Title</title>
<!-- VIEWPORT, AVOID BROWSER NAV BAR, AND HANDHELD DECLARATIONS -->
@ginkosen
ginkosen / TeamViewer-id-changer.py
Created December 22, 2019 07:27 — forked from caobug/TeamViewer-id-changer.py
TeamViewer ID Changer for MAC OS
#!/usr/bin/env python
#coding:utf-8
import sys
import os
import glob
import platform
import re
import random
import string
@ginkosen
ginkosen / eventBus.js
Created December 10, 2019 08:12 — forked from PierfrancescoSoffritti/eventBus.js
A simple implementation of an event bus in Javascript. More details here: https://medium.com/@soffritti.pierfrancesco/create-a-simple-event-bus-in-javascript-8aa0370b3969
/**
* subscriptions data format:
* { eventType: { id: callback } }
*/
const subscriptions = { }
const getNextUniqueId = getIdGenerator()
function subscribe(eventType, callback) {
const id = getNextUniqueId()
@ginkosen
ginkosen / Install_Qt.md
Created March 19, 2019 09:47 — forked from raulqf/Install_Qt.md
How to install Qt libraries on Linux from source code

How to install Qt on Linux from source code

One of the best option is to use the run package offered by Qt to install the libraries and its IDE (Qt Creator). Nevertheless However, when you want to compile it for a sever, where no GUI is required, you must be then interested in how to compile from source and discover some of the configuration options you have to disable some GUI modules among others and get lightest weight libraries.

First of all download the tar.xz file from Qt. You can also go to the archive and select the best that fulfill your requirement. Right now I am going on with the newest version up to the moment v5.9.3.

Create a directory and uncompress the downloaded file:

  $ mkdir temp

$ cd temp

@ginkosen
ginkosen / README.md
Created May 3, 2018 04:12 — forked from nicerobot/README.md
Mac OS X uninstall script for packaged install of node.js

To run this, you can try:

curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh
chmod +x ./uninstall-node.sh
./uninstall-node.sh
rm uninstall-node.sh