Skip to content

Instantly share code, notes, and snippets.

@CrCs2O4
CrCs2O4 / gems_homepages.rb
Last active June 4, 2018 19:04
Get ruby gems homepages fo fast googling. Sometimes 'gem list' is not enough
#!/usr/bin/env ruby
# bundler exec ruby gems_homepages.rb
# based on http://stackoverflow.com/questions/5177634/list-of-installed-gems
require 'rubygems'
def local_gems
Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.group_by{ |g| g.name }
end
puts local_gems.map{ |name, specs|
@CrCs2O4
CrCs2O4 / git_cherry_pick.rb
Created August 11, 2016 07:39
Ruby magic on cherry picking whole branch with merge fast-forward problems
#!/usr/bin/env ruby
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
# you need to change this :)
commits = %w(a3d2f06 5a7867b f732f0c 1ae71c7 43c2c18 04d4e3c f477de2 446558e eec5628 2a8ea6a 8143565 4d54f04 87e04e2 4b6d641 0cdb2a6 de5af95)
# reverse because we need to cherry-pick commits first-last
#!/bin/bash
pwd
mkdir logs
export dir=$(pwd)
export ERRFILE=${dir}/logs/${LOGFILE}
cat /etc/os-release
@CrCs2O4
CrCs2O4 / yardoc_cheatsheet.md
Last active October 23, 2016 17:38 — forked from chetan/yardoc_cheatsheet.md
YARD cheatsheet

YARD CHEATSHEET http://yardoc.org

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

# Namespace for classes and modules that handle serving documentation over HTTP
# @since 0.6.0
[
{ "keys": ["super+shift+'"], "command": "prompt_add_folder" },
{ "keys": ["super+shift+c"], "command": "goto_window" },
{ "keys": ["super+ctrl+s"], "command": "toggle_side_bar" },
{ "keys": ["super+ctrl+r"], "command": "reveal_in_side_bar" },
// { "keys": ["super+shift+right"], "command": "run_macro_file", "args": {"file": "res://Packages/User/split_and_move_to_pane.sublime-macro"}},
{ "keys": ["super+shift+right"], "command": "chain", "args": {"commands": [
[ "split_pane", {"commands": ["v"]} ],
[ "move_to_pane", {"direction": "right"} ]
]}
fsck --lost-found | grep commit | cut -d ' ' -f 3 | xargs -n 1 git log -n 1 --pretty=oneline
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or

Keybase proof

I hereby claim:

  • I am crcs2o4 on github.
  • I am crcs2o4 (https://keybase.io/crcs2o4) on keybase.
  • I have a public key ASABfJb3r9zFrMNVfB-t5KtZAVCwo4M-9iWkqKqFXWoYrwo

To claim this, I am signing this object: