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
test |
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
shop_id = SHOP_ID | |
channel_response_id = CHANNEL_RESPONSE_ID | |
channel_response_token = CHANNEL_RESPONSE_TOKEN | |
time = Time.now.to_i.to_s | |
seed = rand(1..99) | |
resourceSig = Digest::SHA256.hexdigest('GET' + "\n" + 'api-order.miinto.net' + "\n" + "/shops/#{shop_id}/orders" + "\n") | |
headerSig = Digest::SHA256.hexdigest(channel_response_id + "\n" + time + "\n" + seed + "\n" + 'MNT-HMAC-SHA256-1-0') | |
payloadSig = Digest::SHA256.hexdigest('') |
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 'sidekiq/web' | |
run Rack::URLMap.new \ | |
'/' => SomeRackApp, | |
'/sidekiq' => Sidekiq::Web |
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 | |
failed=false | |
ruby_files_modified=`git diff --staged --name-only --diff-filter=ACRM | grep -E '(\.rb|\.ruby|\.rake)' | xargs` | |
if ! [ -z "$ruby_files_modified" ]; then | |
printf '\e[1m\e[34m========= reek ============\n\e[0m' | |
bundle exec reek $ruby_files_modified | |
if [ $? != 0 ]; 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
require 'fileutils' | |
FileUtils.cd('/users/username/pictures') do | |
files = Dir['cats/*'] | |
files.each do |file_path| | |
filename = File.basename(file_path) | |
FileUtils.mv(filename, "cat_#{filename}") | |
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
require 'fileutils' | |
dirs = Dir["/users/username/pictures/categories/*"] | |
dest_folder = "/users/username/pictures/pets/" | |
dirs.each do |dir| | |
pics = Dir["#{dir}/*"] | |
pics.each do |pic| |
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
# config/schedule.rb | |
require_relative './environment' | |
def timezoned time | |
Time.zone.parse(time).utc | |
end | |
every :monday, at: timezoned('12am') do | |
rake 'some:task' |
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 | |
FILES='(js|css|rb)' | |
FORBIDDEN='(<<<<<<<|=======|>>>>>>>|binding.pry|throw|debugger|console.log|\!important)' | |
GREP_COLOR='4;5;37;41' | |
if [[ $(git diff --cached --name-only | grep -E $FILES) ]]; then | |
git diff --cached --name-only | grep -E $FILES | \ | |
xargs grep --color --with-filename -n -E $FORBIDDEN && \ | |
echo "Looks like you are trying to commit something you shouldn't. Please fix your diff, or run 'git commit --no-verify' to skip this check, if you must." && \ | |
exit 1 |
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 'csv' | |
CSV.foreach(filename, :headers => true) do |row| | |
User.create!(row.to_hash) | |
end |