Skip to content

Instantly share code, notes, and snippets.

@fj-auto
fj-auto / HTML-starting-template.html
Last active August 29, 2015 14:27
HTML: starting template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="css/app.css">
</head>
<body>
</body>
@fj-auto
fj-auto / eventUtility.js
Last active August 29, 2015 14:28 — forked from justinwhall/eventUtility.js
JS | Cross Browsers Event Utility Object
var eventUtility = {
addEvent : function(el, type, fn) {
if (typeof addEventListener !== "undefined") {
el.addEventListener(type, fn, false);
} else if (typeof attachEvent !== "undefined") {
el.attachEvent("on" + type, fn);
} else {
el["on" + type] = fn;
}
},
@fj-auto
fj-auto / dpr.js
Last active April 23, 2020 04:22
移动端web伸缩方案
var dpr, rem, scale,
docElem = document.documentElement,
fontElem = document.createElement('style'),
metaElem = document.querySelector('meta[name="viewport"]');
dpr = window.devicePixelRatio || 1; // 获取屏幕dpi, default设为1
rem = docElem.clientWidth * dpr / 10; // 根据屏幕宽度和dpr来动态计算base 'rem' font-size, 取10是为了好计算
scale = 1 / dpr; // 不用再傻傻的拿[设计稿/2];
// 同时也处理retina屏幕下border: 1px的情况;
@fj-auto
fj-auto / scale.js
Last active February 2, 2016 10:29
移动Web伸缩方案
(function() {
var dpr, rem, scale,
resize = 'orientationchange' in window ? 'orientationchange' : 'resize',
docElem = document.documentElement,
fontElem = document.createElement('style'),
metaElem = document.querySelector('meta[name="viewport"]');
dpr = docElem.clientWidth >= 540 ? 1 : window.devicePixelRatio || 1;
rem = docElem.clientWidth * dpr / 10;
scale = 1 / dpr;
@fj-auto
fj-auto / js-challenges-SIF.js
Created February 24, 2016 03:41
[js-challenges-book] Self Invoking Functions 答案
var testValue;
function test() {
testValue = 3;
}();
// 问题1:
// 答案 =>
//
@fj-auto
fj-auto / angularjs$q.js
Created March 23, 2016 03:13
angularJS $q Promise
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body ng-app="app">
<div ng-controller="mainController">
@fj-auto
fj-auto / gist:6d86b31f114e4b2314280219983ad7f5
Created February 2, 2017 06:25 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@fj-auto
fj-auto / gist:48bb379cd1510be2f066d5bf22eee9ed
Created February 2, 2017 06:57
`brew install node` can't symlink notes
sudo chown -R `whoami`:admin /usr/local/bin
sudo chown -R `whoami`:admin /usr/local/share
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@fj-auto
fj-auto / MySQL_macOS_Sierra.md
Created November 2, 2021 08:42 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :