- git diff
- git grep
定番!
よく使っているコマンドを調べてみました。(とりあえず トップ20 だけ抜き出し)
$ egrep -o ';g(?:it)?\s\w*' ~/.zsh_history | cut -f 2 -d ' ' | sed -e "s/^co$/checkout/" -e "s/^st$/status/" -e "s/^lg/log/" | sort | uniq -c | sort -r
#coding: utf-8 | |
class Intersection | |
def to_square(p, q) | |
xs = [p[0], q[0]].min.to_i | |
xe = [p[0], q[0]].max.to_i | |
ys = [p[1], q[1]].min.to_i | |
ye = [p[1], q[1]].max.to_i | |
pos = Array.new(10, 0) | |
line = (xs..xe).inject(0) {|a, i| a + (2**i)} | |
(ys..ye).each {|y| pos[y] = line} |
{-# OPTIONS -Wall #-} | |
-- Not,And,Or,Xor を独自実装 | |
myAnd :: Bool -> Bool -> Bool | |
myAnd True True = True | |
myAnd _ _ = False | |
myNot :: Bool -> Bool | |
myNot False = True | |
myNot _ = False |
chrome.contextMenus.create({ | |
title: "var_dump を挿入", | |
contexts: ["selection"], | |
documentUrlPatterns: ["http://sandbox.onlinephpfunctions.com/"], | |
onclick: function() { | |
chrome.tabs.executeScript(null, {file: "content_script.js"}); | |
} | |
}); |
<?php | |
// ============ | |
// View | |
// ============ | |
class View { | |
protected $base_path = '.'; | |
public function render($_filename, $_params = array()) { | |
$_filepath = $this->base_path . '/' . $_filename; | |
if (substr($_filepath, -4, 4) !== '.php') { $_filepath .= '.php'; } |
require 'rspec' | |
module HuntingMonsters | |
class Player | |
attr_reader :weapons | |
def initialize | |
@weapons = [] | |
end |
def sort_with_other_row(table, idx) | |
row = table[idx] | |
# [ソート前のカラムのインデックス値, ...] | |
ex_sort_idxs = row.map | |
.with_index { |e, idx| [e, idx] } | |
.sort_by | |
.with_index { |cell, idx| [cell.first, idx] } | |
.map(&:last) |
<!doctype html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8"> | |
<title>カレーのレシピ</title> | |
<meta name="description" content="誰でもできる、美味しいカレーの作り方です。旦那も息子もこのカレーが大好物。"> | |
</head> | |
<body> | |
<header> | |
<h1>カレーのレシピ</h1> |
require 'minitest' | |
require 'minitest/autorun' | |
require 'pry' | |
MAX_WIDTH = 5 | |
MAX_HEIGHT = 5 | |
SENTINEL_CHER = -1 | |
def solve(str) | |
init_numbers_field(str) |
include_recipe 'yum' | |
yum_repository 'remi' do | |
baseurl "http://rpms.famillecollet.com/enterprise/#{node[:platform_version].to_i}/remi/#{node[:kernel][:machine]}/" | |
enabled false | |
gpgkey 'http://rpms.famillecollet.com/RPM-GPG-KEY-remi' | |
action :create | |
end |