Skip to content

Instantly share code, notes, and snippets.

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 31, 2026 19:44
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@unak
unak / history.txt
Last active May 21, 2026 11:18
The History of Ruby
* Only the releases of the stable versions are listed in principle. The releases of the unstable versions especially considered to be important are indicated as "not stable."
* The branches used as the source of each releases are specified, and the branching timing of them are also shown. BTW, before subversionizing of the repository, the term called "trunk" was not used, but this list uses it in order to avoid confusion.
* In order to show a historical backdrop, big conferences (RubyKaigi, RubyConf and Euruko) are also listed. About the venues of such conferences, general English notations are adopted, in my hope.
* ruby_1_8_7 branch was recut from v1_8_7 tag after the 1.8.7 release because of an accident.
* 1.2.1 release was canceled once, and the 2nd release called "repack" was performed. Although there were other examples similar to this, since the re-releases were performed during the same day, it does not write clearly in particular.
* Since 1.0 was released with the date in large quantities, the mi
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@andkerosine
andkerosine / raskell.rb
Created August 15, 2012 05:56
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@huacnlee
huacnlee / _form.html.erb
Created August 21, 2012 10:55
UpYun 表单上传验证信息 helper 方法,用于生成 input tag
<form action="http://v0.api.upyun.com/rbtest/" method="post" enctype="multipart/form-data">
<%= upyun_form_input_tag(:return_url => new_post_path) %>
<input type="file" name="file" />
<button type="submit">上传图片</button>
</form>
require 'socket'
module EventEmitter
def _callbacks
@_callbacks ||= Hash.new { |h, k| h[k] = [] }
end
def on(type, &blk)
_callbacks[type] << blk
self
@aoxu
aoxu / coc_1.md
Created January 12, 2013 11:08 — forked from xatest/coc_1.md

#Clash of Clans攻略(一):关键数值的意义

##引言 前段时间对Clash of Clans做了一些游戏策划上的分析,我决定逐篇形成文字公开出来,给新手玩家做个指引,少走点弯路。我的本职工作与游戏策划无关,写此文时我的级别是30级,所以水平有限,多多指教。我不想写过于基础的攻略——有哪些资源,哪些建筑,哪些兵种——这种教程网上一搜一大把。

##关键数值 在游戏主界面上显示的5个数值,无疑是最重要的,分别是等级、奖杯、金币、水、宝石。下面说每个数值代表了什么样的宏观意义。

1. 等级(经验值)

等级代表了整体的建筑水平。经验值有4种输入(增加)途径,按增加的效率排序,1是建造/升级建筑,2是领取成就,3是给同部落盟友送兵,4是去掉地图上的石头/植物(一般叫除草)。其中第1种的增加效率远高于后3种,可以说经验值主要就是通过建造建筑贡献的,反过来经验值也就代表了整体的建筑水平。

@aoxu
aoxu / coc_2.md
Last active September 4, 2018 14:01 — forked from xatest/coc_2.md
Clash of Clans攻略(二):进攻、奖杯与天梯~

#Clash of Clans攻略(二):进攻、奖杯与天梯~ ##引言 防守可以单写一篇来介绍,本篇只谈进攻。进攻与奖杯,奖杯与天梯又密切关联,所以本篇将会一起介绍。

##进攻类建筑 限制村庄发展速度的第一因素是时间,如果你不购买Builder(或者说Builder数量固定),那么第二因素——资源就是你最大的瓶颈。资源的最快获取方式是进攻掠夺。可以说,在所有建筑当中,进攻建筑决定你的发展速度。
上一篇说过,进攻能力主要取决于你的进攻建筑水平,这是大背景。这个道理很自然,比如你的Camp上限总共只有100人口,就不可能有200人口的兵力。所以每次升本(Town Hall)之后,第一件事就是升级进攻类建筑。 进攻类建筑有4种:

  1. 兵工厂(Barracks)。兵工厂至少要有1个升到顶级的,这样才能造高级兵。
@aoxu
aoxu / coc_3.md
Last active November 2, 2016 13:48
Clash of Clans攻略(三):防守~

#Clash of Clans攻略(三):防守~ ##引言 防守的很多技巧是跟进攻密不可分的,从进攻的过程中学习别人的防守技巧,会有助于改善自己的防守。

##防守类建筑

  1. 加农炮(CANNON)。单体攻击,只能对地,攻击力和射程中规中矩。面对人海战术时比较无力,适合补刀。
  2. 箭塔。单体攻击,对地对空,攻击力与加农炮差不多,但是射程很远。适合扩展防守范围,以及防气球流。
  3. 主炮(MORTAR)。溅射攻击,只能对地,攻击力较高,射程最远(比箭塔还远1格)。适合主力输出。
  4. 魔法塔(也叫巫师塔)。溅射攻击,对地对空。攻击力高,射程很短。适合贴身守护核心。成本较高。
  5. 防空塔。单体攻击,只能对空。攻击超高!适合主力对空。
@sasa1977
sasa1977 / xmerl_demo.ex
Last active July 26, 2023 10:07
Simple xmerl usage demo in Elixir
defmodule XmlNode do
require Record
Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl")
Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl")
def from_string(xml_string, options \\ [quiet: true]) do
{doc, []} =
xml_string
|> :binary.bin_to_list
|> :xmerl_scan.string(options)