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
def odd_or_even(x): | |
if x % 2 == 0: | |
return 'even' | |
else: | |
return 'odd' | |
def next_nine_number(x): | |
for i in range(0, 9): | |
x = x + 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
https://github.com/getredash/redash/blob/0456caf798cbdb0de934d7d223861211df7186a3/docker-compose-example.yml | |
https://github.com/getredash/redash/blob/0456caf798cbdb0de934d7d223861211df7186a3/setup/docker/create_database.sh |
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
FROM ruby:2.3.1 | |
MAINTAINER Hirofumi Wakasugi <[email protected]> | |
RUN apt-get update && apt-get install -qq -y build-essential nodejs --fix-missing --no-install-recommends | |
ENV INSTALL_PATH /kawaiichan | |
RUN mkdir $INSTALL_PATH | |
WORKDIR $INSTALL_PATH |
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
require 'test_helper' | |
# clas_eval でダミーのアクションを定義する | |
ApplicationController.class_eval do | |
def dummy_action | |
render :nothing | |
end | |
end | |
# Rails.application.routes.draw が呼ばれたときにルートをクリアする動作を無効にする |
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
require 'strscan' | |
module StringWithCabmridge | |
refine String do | |
def cabmridge_word | |
self[0] + self[1..-2].chars.shuffle.*('') + (self[1] ? self[-1] : '') | |
end | |
def cabmridge_whole_text | |
buffer = StringScanner.new(self) |
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
kebun=->(s){$><<s[0]+(s[1..-2].chars.shuffle*'')+(!s[1]?'':s[-1])} | |
# kebun.call('ケンブリッジ') => ケンブッリジ, ケリッブンジ, ケリンブッジ, ケリブンッジ, ケンッリブジ ... | |
# kebun.call('ケン') => ケン | |
# kebun.call('ケ') => ケ |
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
CRYSTAL = crystal | |
UNAME = "$(shell uname -ms)" | |
LIBRARY_PATH = $(shell brew --prefix crystal-lang)/embedded/lib | |
LIBS = -levent -lpcl -lpcre -lgc -lpthread | |
LDFLAGS = -Wl,-undefined,dynamic_lookup | |
TARGET = crystal_example_ext.bundle | |
$(TARGET): crystal_example_ext.o | |
$(CC) -bundle -L$(LIBRARY_PATH) -o $@ $^ $(LIBS) $(LDFLAGS) |
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 | |
# An example hook script to prevent direct pushing to master excluding the following cases | |
# - All commit logs for the commits to be pushed start with "[ALLOW_MASTER]" | |
# e.g [ALLOW_MASTER] Fix something | |
z40=0000000000000000000000000000000000000000 | |
while read local_ref local_sha1 remote_ref remote_sha1 | |
do |
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/sh | |
# An example hook script to prevent direct pushing to master | |
while read local_ref local_sha1 remote_ref remote_sha1 | |
do | |
# If you also want to prevent direct pushing to branches in addition to master branch, | |
# just copy and paste the below and replace "master" with the branch name you desire. | |
# ==========> Copy & paste START | |
if [[ "${remote_ref##refs/heads/}" = "master" ]]; then |
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 Doala | |
def move(number) | |
hand = -> (n) { n % 2 == 0 ? '⌒' : 'ー' } | |
f = Fiber.new do | |
n = 0 | |
reverse = false | |
line_length = 50 | |
loop do | |
line = "\r" + " " * n + '(' + hand.call(n) + '(´・△・`)' + hand.call(n) + '⌒)' |