Skip to content

Instantly share code, notes, and snippets.

View johnteee's full-sized avatar

John Lee johnteee

  • Taipei
View GitHub Profile
@johnteee
johnteee / installvagrant
Created November 12, 2018 06:44 — forked from rrgrs/installvagrant
installs brew, virtualbox, and vagrant in osx
if ! type "brew" > /dev/null; then
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)";
fi
brew tap phinze/homebrew-cask && brew install brew-cask;
brew cask install vagrant;
brew cask install virtualbox;
@johnteee
johnteee / html2doku
Created October 8, 2018 13:18 — forked from weirdpercent/html2doku
Perl script to convert HTML to Dokuwiki markup using the HTML::WikiConverter module
#!/usr/bin/perl -w
# Perl script to convert HTML files to DokuWiki Markup.
# Requires HTML::WikiConverter Perl module
use HTML::WikiConverter;
print "HTML to DokuWiki markup converter\n";
my $argcnt = $#ARGV + 1;
if ($argcnt == 2) {
print "Converting...";
function random_chinese_name() {
function random(a, l) {
var x = [];
x.push(a[Math.ceil(Math.random() * a.length)]);
while(l > 1) {
x.push(a[Math.ceil(Math.random() * a.length)]);
l--;
}
return x.join("");
}
@johnteee
johnteee / UIView+backgroundImage.swift
Created September 30, 2018 14:50 — forked from mukhortov/UIView+backgroundImage.swift
Add background image to UIView
import UIKit
extension UIView {
func backgroundImage(named: String) {
let backgroundImage = UIImageView(frame: self.frame)
backgroundImage.image = UIImage(named: named)
backgroundImage.contentMode = .scaleAspectFill
backgroundImage.translatesAutoresizingMaskIntoConstraints = false
backgroundImage.center = self.center
backgroundImage.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin, .flexibleTopMargin, .flexibleBottomMargin]
@johnteee
johnteee / index.html
Created September 20, 2018 03:55 — forked from Hexrays/index.html
A CodePen by Jeffd. 3D Rotating Cube - based on this tutorial http://davidwalsh.name/css-cube?utm_source=html5weekly&utm_medium=email
<div class="wrap">
<div class="cube">
<div class="front">front</div>
<div class="back">back</div>
<div class="top">top</div>
<div class="bottom">bottom</div>
<div class="left">left</div>
<div class="right">right</div>
</div>
</div>
@johnteee
johnteee / nginx-tuning.md
Created September 19, 2018 03:01 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

char *x; // x: a pointer to char
char x[3]; // x: an array[3] of char
char x(); // x: a function() returning char
char *x[3]; // x: an array[3] of pointer to char
char (*x)[3]; // x: a pointer to array[3] of char
char **x; // x: a pointer to pointer to char
char *x(); // x: a function() returning pointer to char
char *x()[3]; // x: a function() returning array[3] of pointer to char
char (*x[])(); // x: an array[] of pointer to function() returning char
char (*x())(); // x: a function() returning pointer to function() returning char

Shattering Images

I tried to make a gallery, but the images keep shattering when I click on them... I'll need to use more sturdy materials next time.

(Delaunay triangulation part 2)

A Pen by Szenia Zadvornykh on CodePen.

@johnteee
johnteee / main.css
Created September 5, 2018 08:51 — forked from 6174/main.css
cracked glass effect http://codepen.io/mlegane/pen/kKEyH
/* ------------------------------------------- *\
Main
\* ------------------------------------------- */
html {
background: #DAD8DB;
text-align: center;
}
body {
font: 16px sans-serif;
color: #000;
@johnteee
johnteee / polyfills.html
Created September 5, 2018 05:08 — forked from jacoduplessis/polyfills.html
Load Promise and Fetch polyfills conditionally (updated 8 Jan 2016)
<script>
window.Promise || document.write('<script src="https://unpkg.com/[email protected]/dist/es6-promise.min.js"><\/script>');
window.fetch || document.write('<script src="https://unpkg.com/[email protected]/fetch.js"><\/script>');
</script>