This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DoNotDisturb | |
def initialize | |
@desk = InformationDesk.new | |
end | |
def method_missing(name, *args) | |
unless name.to_s == "emergency" | |
hour = Time.now.hour | |
raise "Out for lunch" if hour >= 12 && hour < 14 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(end_date.year * 12 + end_date.month) - (start_date.year * 12 + start_date.month) + (end_date.day >= start_date.day ? 1 : 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Recursive sorting algorithm for Hash | |
class Hash | |
def sort_by_key(recursive = false, &block) | |
self.keys.sort(&block).reduce({}) do |seed, key| | |
seed[key] = self[key] | |
if recursive && seed[key].is_a?(Hash) | |
seed[key] = seed[key].sort_by_key(true, &block) | |
end | |
seed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"user": { | |
"debug": false, | |
"delay": 0.25, | |
"error_color": "D02000", | |
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme", | |
"gutter_theme_excludes": [], | |
"lint_mode": "background", | |
"linters": { | |
"eslint": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# This hook has a focus on portability. | |
# This hook will attempt to setup your environment before running checks. | |
# | |
# If you would like `pre-commit` to get out of your way and you are comfortable | |
# setting up your own environment, you can install the manual hook using: | |
# | |
# pre-commit install --manual | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
# Atlassian Stash and Pivotal Tracker Integration | |
# =============================================== | |
# - Post commit message details on Pivotal Tracker's user story | |
# Usage | |
# ===== | |
# Create a branch with hash(#) + user story id. (#123467) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
GIT_OPTS="" | |
OUTPUT_FILTER="cat" # no-op | |
commit_id_format=$(tput setaf 1) | |
date_format=$(tput bold; tput setaf 4) | |
author_format=$(tput setaf 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# actually parse the options and do stuff | |
while [[ $1 = -?* ]]; do | |
case $1 in | |
--gc) | |
echo "Repacking objects" | |
git gc --aggressive --auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete remote branches except `master` and `development` | |
git branch -r --merged | grep origin | grep -v '>' | grep -v master | grep -v development | grep -v sprint | xargs -L1 | cut -d"/" -f2- | xargs git push origin --delete > ~/Documents/remote_branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Bar | |
def self.included(base) | |
class << base | |
def public_method # public method | |
puts "public method" | |
end | |
def call_private # public method | |
puts "Call Private from Public" | |
private_method |
OlderNewer