Skip to content

Instantly share code, notes, and snippets.

View vampireneo's full-sized avatar
👨‍💻
Coding

Neo Choi vampireneo

👨‍💻
Coding
View GitHub Profile
@vampireneo
vampireneo / README.md
Created February 8, 2018 16:40 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@vampireneo
vampireneo / redirect.html
Created June 3, 2016 09:27
Redirect html page
<html>
<head>
<title>Redirect</title>
<META http-equiv="refresh" content="0;URL=http://www.google.com">
</head>
<body>
</body>
</html>
@vampireneo
vampireneo / toRomanNumerals.js
Created May 31, 2016 07:50
Convert a number to Roman Numerals
function solution(roman){
let RomanNum = {
10: { 1: 'I', 5: 'V'},
100: { 1: 'X', 5: 'L'},
1000: { 1: 'C', 5: 'D'},
10000: { 1: 'M'}
};
let result = '';
for (let d in RomanNum) {
let tmp = '';
@vampireneo
vampireneo / Mac.md
Last active April 1, 2016 17:23
How to set an environment variable in Mac?

#For OS X 10.8, 10.9, 10.10

To set an environment variable:

launchctl setenv variable "value"

To view an environment variable:

launchctl getenv variable
@vampireneo
vampireneo / change.sql
Created February 23, 2016 08:47
Change Table / View Schema in MSSQL
ALTER SCHEMA TargetSchema
TRANSFER SourceSchema.TableName;
@vampireneo
vampireneo / DislikeShowLo.html
Last active January 18, 2016 06:07
羅志祥 Dislike Counter
<html>
<head>
<meta charset="UTF-8">
<title>羅志祥 Dislike Counter</title>
<meta content='zh_HK' property='og:locale'/>
<meta content='https://s3-ap-southeast-1.amazonaws.com/d74689/DislikeShowLo.html' property='og:url'/>
<meta content='羅志祥 Dislike Counter' property='og:title'/>
<meta content='website' property='og:type'/>
<meta content='http://1.bp.blogspot.com/-hSrFzRVJ_XM/Vpx9EDkL9hI/AAAAAAAAh40/OPC3TaUKz24/s1600/plastic.png' property='og:image'/>
@vampireneo
vampireneo / detectMobileOperatingSystem.js
Last active August 29, 2015 14:16
detecting mobile operating system by javascript
function getMobileOperatingSystem() {
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
if( userAgent.match( /iPad/i ) || userAgent.match( /iPhone/i ) || userAgent.match( /iPod/i ) )
{
return 'iOS';
}
else if( userAgent.match( /Android/i ) )
{
return 'Android';
}
@vampireneo
vampireneo / gist:9461976
Last active August 29, 2015 13:57
解決 git ignore 無法生效
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
@vampireneo
vampireneo / index.htm
Created February 28, 2014 07:55
HTML for embed another page by iframe, without border
<html>
<head>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
</head>
<body style="margin:0px;padding:0px;overflow:hidden">
<iframe src="__URL_HERE__" frameborder="0" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px" height="100%" width="100%"></iframe>
</body>
</html>
@vampireneo
vampireneo / gist:4146791
Created November 26, 2012 05:59
string.format function
String.prototype.format = function() {
var str = this;
for (var i = 0; i <= arguments.length - 1; i++) {
var reg = new RegExp("\\{" + i + "\\}", "gm");
str = str.replace(reg, arguments[i]);
}
return str;
};