Skip to content

Instantly share code, notes, and snippets.

View Stevearzh's full-sized avatar
🐈
Thinking

Steve Zhang Stevearzh

🐈
Thinking
View GitHub Profile
#!/bin/bash
# function Extract for common file formats
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
else
if [ -f "$1" ] ; then
NAME=${1%.*}
#!/bin/env node
var express = require('express');
var fs = require('fs');
var irc = require('irc');
var Dota2Api = require('dota2-api');
//DOTA_API_KEY = 'D3FE4C4AAE0631B3D9C0E3D4E6560D4F';
var da = Dota2Api.create('D3FE4C4AAE0631B3D9C0E3D4E6560D4F');
var heroes = [];
@MaskRay
MaskRay / a.js
Last active March 15, 2016 05:59
新浪AlphaGo对李世乭文字直播desktop notification
文字直播,网页载入后,打开devtools(一般是F12),在Console里输入一行js,即可获取通知。若弹出对话框提示Allow notification?选Allow。
http://bn.sina.cn/video/live/index/tech/alphago?vt=4 人机围棋大战
Notification.requestPermission(function() { $('section').on('DOMSubtreeModified', function() { var n = new Notification('meow', {body: $('section .chat_item p').eq(0).text().trim()}); setTimeout(function() { n.close() }, 10000) }) })
http://lives.sina.cn/live/live?live_mg=sports&wm=&livetype=qipai&stype=&vt=4&match_id=l_142874 李世石VS谷歌AlphaGo 人机大战III
http://lives.sina.cn/live/live?live_mg=sports&wm=&livetype=qipai&stype=&vt=4&match_id=l_142961 李世石VS谷歌AlphaGo 人机大战Ⅳ
http://lives.sina.cn/live/live?live_mg=sports&wm=&livetype=qipai&stype=&vt=4&match_id=l_143040 李世石VS谷歌AlphaGo 人机大战V
var orig_increment_apply_do = window.increment_apply_do; window.increment_apply_do = function(rs) { Notification.requestPermission(function() { var n = new Notification('meow', {body: rs.data[0].content}); setTimeout(function() { n.close() }, 10000) }); return orig_increment_apply_do(rs)
@chantastic
chantastic / on-jsx.markdown
Last active November 10, 2024 13:39
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@xero
xero / irc.md
Last active May 6, 2025 20:51
irc cheat sheet
@pkuczynski
pkuczynski / LICENSE
Last active March 14, 2025 14:12
Read YAML file from Bash script
MIT License
Copyright (c) 2014 Piotr Kuczynski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWAR
@jagt
jagt / roguelike-dossier.mkd
Last active March 16, 2025 16:46
roguelike-dossier

Roguelike 到底是啥

讲讲 Roguelike 相关知识

最后更新 2013.5.28

引言

如果你是一位资深游戏玩家,那么最近你肯定在哪里看到过 Roguelike 这个词。Roguelike 这个古老的游戏类型现在又变得很潮流,其中各种要素都在不断的被新游戏借鉴。作为一名就是比你有更多空余时间的高玩,我想在这里介绍一下我了解的 Roguelike 相关的东西。文章很长,但应该会比较有意思。

@mahata
mahata / eshell-path-env.el
Created September 15, 2012 19:47
eshell-path-env and PATH
(defun eshell-mode-hook-func ()
(setq eshell-path-env (concat "/usr/local/bin:" eshell-path-env))
(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))
(define-key eshell-mode-map (kbd "M-s") 'other-window-or-split))
(add-hook 'eshell-mode-hook 'eshell-mode-hook-func)
@cdown
cdown / gist:1163649
Last active April 14, 2025 22:42
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in