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
// Examples: | |
// Valid: "3973535717", "2037637860", "2823097943", "2012460224" | |
// Not Valid: "3973535711", "123", "9999999999", | |
function verifyVkn(vkn) { | |
if (typeof vkn !== 'string') throw new TypeError('vkn should be a string'); | |
if (vkn.length !== 10) throw new TypeError('invalid length'); | |
const digits = vkn.split(''); | |
const control = digits.pop(); // eslint-disable-line |
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
# Old Ruby Versions error | |
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2t rbenv install 2.3.3 | |
# therubyracer gem install fails. Solution: | |
bundle config --local build.therubyracer --with-v8-dir=$(brew --prefix v8-315) | |
# Mysql2 Error | |
brew install openssl| | |
gem install mysql2 -v '0.4.10' | |
# if still fails run: |
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
# gem install azure-storage --pre | |
# gem install aws-sdk | |
require 'aws-sdk' | |
require "azure" | |
require 'open-uri' | |
s3 = Aws::S3::Resource.new( | |
access_key_id: 'AKIA...', | |
secret_access_key: '************************************', |
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
brew install ffmpeg | |
brew cask install x-quartz #dependency for gifsicle, only required for mountain-lion and above | |
open /usr/local/Cellar/x-quartz/2.7.4/XQuartz.pkg # runs the XQuartz installer | |
brew install gifsicle | |
ffmpeg -i ~/Desktop/in1080.mov -s 920x540 -pix_fmt rgb24 -r 18 -f gif - | gifsicle --optimize=3 --delay=3 > ~/Desktop/out.gif |
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
server 'staging-ip', user: 'staging-user', roles: %w{app db} | |
set :branch, ENV['BRANCH'] | |
set :application, 'application-name' | |
set :repo_url, "[email protected]:your-repo-git-url.git" | |
set :deploy_to, "/home/ubuntu/apps/#{fetch(:application)}/#{fetch(:branch)}" | |
set :keep_releases, 1 | |
set :copy_exclude, %w(.git/* tmp/*) | |
set :linked_dirs, %w{log tmp/pids tmp/cache vendor/bundle tmp/sockets} |
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
server { | |
listen 80; | |
server_name ~^(?<branch_name>.+)\.(?<branch_prefix>.+)\.(?<app_name>.+)\.staging\.exampledomain\.com$; | |
root /home/apps/$app_name/$branch_prefix/$branch_name/public; | |
try_files $uri/index.html $uri @app; | |
location @app { | |
proxy_pass http://unix:/home/ubuntu/apps/$app_name/$branch_prefix/$branch_name/shared/tmp/sockets/puma.sock; |
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
image: "ruby:2.3.3" | |
before_script: | |
- ruby -v | |
- which ruby | |
- gem install bundler --no-ri --no-rdoc | |
- bundle install --jobs $(nproc) "${FLAGS[@]}" | |
staging_deploy: | |
except: |
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
@font-face { | |
font-family: 'ABeeZee'; | |
font-style: normal; | |
font-weight: 400; | |
src: local('ABeeZee'), local('ABeeZee-Regular'), url(http://fonts.gstatic.com/s/abeezee/v9/JYPhMn-3Xw-JGuyB-fEdNA.ttf) format('truetype'); | |
} | |
@font-face { | |
font-family: 'Abel'; | |
font-style: normal; | |
font-weight: 400; |
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
# brew install terminal-notifier | |
# gem install rufus-scheduler | |
# type `irb` | |
require 'rufus-scheduler' | |
ENV['TZ'] = 'UTC' | |
period = '*/10 * * * *' # every 10 minutes cron | |
scheduler = Rufus::Scheduler.new |
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 'json' | |
PRIVATE_TOKEN = "" | |
NEW_PRIVATE_TOKEN = "" | |
OLD_GITLAB_URL = "" | |
NEW_GITLAB_URL = "http://gitlab.org/api/v3" | |
PATH = "" | |
res = `curl --header "PRIVATE-TOKEN: #{PRIVATE_TOKEN}" #{OLD_GITLAB_URL}/groups/` | |
groups = JSON.parse res |