Skip to content

Instantly share code, notes, and snippets.

View 6174's full-sized avatar

Marc Chen 6174

View GitHub Profile
@6174
6174 / github_stacktrace.js
Last active April 26, 2024 10:20
stackTracejs
// Domain Public by Eric Wendelin http://eriwen.com/ (2008)
// Luke Smith http://lucassmith.name/ (2008)
// Loic Dachary <loic@dachary.org> (2008)
// Johan Euphrosine <proppy@aminche.com> (2008)
// Oyvind Sean Kinsey http://kinsey.no/blog (2010)
// Victor Homyakov <victor-homyakov@users.sourceforge.net> (2010)
/*global module, exports, define, ActiveXObject*/
(function(global, factory) {
if (typeof exports === 'object') {
// Node
<!DOCTYPE html>
<html>
<head>
<title>DEMO</title>
<script type="text/javascript" src="simple_javascript_templating.js"></script>
</head>
<body>
<table id="table_1">
</table>
<script type="text/html" id="tmpl_1">
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@6174
6174 / golang-tls.md
Created December 12, 2016 06:33 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
/*
* Javascript Diff Algorithm
* By John Resig (http://ejohn.org/)
* Modified by Chu Alan "sprite"
*
* Released under the MIT license.
*
* More Info:
* http://ejohn.org/projects/javascript-diff-algorithm/
*/
<!doctype html>
<html>
<head>
<title>Mathcha</title>
<link rel="stylesheet" href="/resources/fonts-8fdb539.css" />
<link rel="icon"
type="image/png"
href="/resources/logo.png"/>
<meta name=viewport content="width=device-width, height=device-height, initial-scale=1">
@6174
6174 / watercolors.js
Created August 16, 2021 14:11 — forked from zapthedingbat/watercolors.js
Generate watercolor style blobs: Inspired by tyler hobbs's generative watercolors- https://tylerxhobbs.com/
(function(doc) {
const TWO_PI = Math.PI * 2;
const HALF_PI = Math.PI / 2;
const RADIUS_SCALE = 0.05;
const RADIUS_SD = 15;
const POLYGON_SIDES = 5;
const POSITION_SD = 0.04;
const BASE_DEFORMATIONS = 3;
const LAYER_DEFORMATIONS = 3;
const LAYERS = 40;
@6174
6174 / canvas-blur-image.js
Last active June 28, 2022 17:50
canvas image blur
/**
* Light layer on top of a canvas element to represent an image displayed
* within. Pass in a canvas element and an Image object and you'll see the
* image within the canvas element. Use the provided methods (e.g. blur) to
* manipulate it.
*
* @constructor
* @param {HTMLElement} element HTML canvas element.
* @param {Image} image Image object.
*/
@6174
6174 / socket.io.sessionID.js
Created August 17, 2013 03:31
set session id to socket in nodejs
/**
* Module dependencies.
*/
var express = require('express');
var routes = require('./routes');
var user = require('./routes/user');
var http = require('http');
var path = require('path');
/* ------------------------------------------- *\
Main
\* ------------------------------------------- */
html {
background: #DAD8DB;
text-align: center;
}
body {
font: 16px sans-serif;
color: #000;