Skip to content

Instantly share code, notes, and snippets.

View neekey's full-sized avatar
🎯
Focusing

Neekey neekey

🎯
Focusing
View GitHub Profile
@neekey
neekey / hosts
Created August 27, 2012 03:38
My hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
@neekey
neekey / chrome_extension_get_cookie.js
Created September 8, 2013 15:16
Chrome 插件获取指定域下的Cookie,代码示例
@neekey
neekey / sass.md
Last active November 30, 2022 16:03
SASS

Setup/Learning Curve 安装/学习曲线

SASS的安装和学习成本都不高,所有的CSS语法在SASS中都是合法的(.scss)

  • ruby & gem install sass
  • same as CSS / LESS

Mixin 混合

SASS在混合这块和LESS的却别主要在于需要显性地使用@mixin来定义混合,以及@include来引入混合,这样的方式看似麻烦,但是实际上增加了代码的可读性,并且让混合的功能更加专一。

  • @mixin
@neekey
neekey / multiple-line-jsx-with-parentheses.tsx
Created April 30, 2021 14:12
[artile-codegist]Why You Should Wrap Your JSX With Parentheses
const homePageLink = currentPage !== 'home' ? (
<a
className="home-page-link"
target="_blank"
href="#home">
Home
</a>
) : null;
@neekey
neekey / gist-blog-cleanup_install_ruby_manually.md
Last active February 2, 2021 13:15
Mac下手动清理/安装Ruby

本文介绍如何在Mac OSX下手动清理和安装Ruby。献给所有不怎么懂Ruby,但是又时常为Ruby纠结的人。

清理

所谓清理的话,其实只要看看Ruby在安装的时候做了什么就好了。好在Ruby自己源码安装的时候很体贴地会把自己干的事情总结出来:

installing binary commands:   /usr/local/bin
installing base libraries:    /usr/local/lib
installing arch files:        /usr/local/lib/ruby/1.9.1/x86_64-darwin12.2.0
@neekey
neekey / spotlight.js
Created February 1, 2017 23:36
spotlight
/* eslint-disable */
import EventEmitter from 'wolfy87-eventemitter';
import isFunction from 'lodash/isFunction';
import isNumber from 'lodash/isNumber';
import isString from 'lodash/isString';
import isPlainObject from 'lodash/isPlainObject';
function eventDelegate(dom, eventName, className, handler) {
dom.addEventListener(eventName, function (e) {
const target = e.target;
@neekey
neekey / index.html
Created June 21, 2016 10:38
parse-server-github-oauth
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://www.parsecdn.com/js/parse-latest.js"></script>
<script src="https://adodson.com/hello.js/dist/hello.all.min.js"></script>
</head>
<body>
@neekey
neekey / common.js
Created May 21, 2014 06:55
commonJS for all platform
!(function(){
/**
* 判断当前JS环境
*/
var hasDefine = typeof define === 'function';
var hasExports = typeof module !== 'undefined' && module.exports;
var Mod = function(){
/* write your code */
@neekey
neekey / proxy.html
Created September 4, 2012 02:58
iframe - proxy
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>iframe - proxy</title>
</head>
<body>
<script>
@neekey
neekey / gist-blog-browser-js-error-catch-summary.md
Last active July 31, 2020 10:14
浏览器错误捕捉总结

捕捉浏览器中的JS运行时错误,主要通过监听window.onerror来实现。但是对于不同的脚本执行方式以及不同的浏览器,能捕获到的信息会有区别。

window.onerror 讲接收3个参数:

  • msg:错误描述,比如:a is not defined
  • url:出错脚本所在的url
  • lineNumber:出错脚本的行数

本文将对不同浏览器和不同的脚本执行方式进行测试,并总结这些区别。