Skip to content

Instantly share code, notes, and snippets.

@alChaCC
alChaCC / brew-java-and-jenv.md
Last active July 23, 2020 09:17 — forked from tomysmile/brew-java-and-jenv.md
How To Install Java 8 on Mac

Install HomeBrew first

brew update
brew tap caskroom/cask
brew install brew-cask

If you get the error "already installed", follow the instructions to unlink it, then install again:

Easyship Open API for Shopmatic

This documentation comes in addition to the main Easyship API documentation to offer additional functionality.

The API endpoints dedicated to Shopmatic can be used to create users and stores, create stores for existing users, get rates and get categories.

For any questions related to the Easyship API, please contact api-support@easyship.com

POST Create and link a new Shopmatic user

@alChaCC
alChaCC / Easyship-Simple-Oauth.md
Last active July 3, 2019 03:12
Easyship SImple Oauth Integration

Purpose

To Connect your application with Easyship

Authentication

You will need to apply an administrator Easyship API token for your application.

Flows

@alChaCC
alChaCC / mp3_tags_render.rb
Last active June 26, 2016 04:02
mp3 tag render using Ruby
#!/usr/bin/env ruby
require 'rubygems' # necessary for ruby v1.8.*
require 'micro-optparse'
options = Parser.new do |p|
p.option :path, 'folder location', default: 'String'
p.option :album, 'album name', default: 'String'
p.option :artist, 'artist name', default: 'String'
p.option :songuse, 'filename or tags', default: 'String'
end.process!
@alChaCC
alChaCC / MongoDB Mongoid 5.0.0.beta Teardown
Last active August 29, 2015 14:27 — forked from stuartmackey/MongoDB Mongoid Teardown
Teardown script to remove MongoDB collections after each test run in Rails
teardown :clean_mongodb
def clean_mongodb
Mongoid::Clients.default.database.collections.each do |collection|
unless collection.name =~ /^system\./
collection.remove
end
end
end
setwd("r-playground/R/ga_engagement")
list.of.packages <- c("rjson", "RCurl","RGoogleAnalytics")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
require(rjson)
require(RCurl)
require(RGoogleAnalytics)
require(ggplot2)
token <- Auth('YOUR API USER ID','YOUR API USER PASSWORD')
save(token,file="./token_file")
#!/usr/bin/env bash
# Pre-requisites
sudo apt-get -y update
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev vim git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
# Download and compile Ruby 2.1.2
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
tar -xvzf ruby-2.1.2.tar.gz
cd ruby-2.1.2
@alChaCC
alChaCC / sync_to_S3.cap
Created March 27, 2014 02:59
lib/capistrano/tasks/sync_to_S3.cap
namespace :deploy do
namespace :assets do
desc "Synchronize assets to S3"
task :sync do
on roles(:asset_syncer) do |role|
within "#{release_path}"do
with rails_env: "#{fetch(:rails_env)}" do
execute :rake, "assets:sync"
end
end
@alChaCC
alChaCC / restart.cap
Created March 27, 2014 02:58
lib/capistrano/tasks/restart.cap
namespace :deploy do
desc "Restart passenger process"
task :restart do
on roles(:web), in: :sequence, wait: 5 do
execute "touch", "#{release_path}/tmp/restart.txt"
end
end
end
@alChaCC
alChaCC / new Staging.rb
Created March 27, 2014 02:56
config/deploy/staging.rb
set :branch, 'develop'
set :user, 'stage_deployer'
set :domain, 'staging.your.domain'
set :rails_env, "staging"
set :deploy_to, "/home/#{fetch(:user)}/urbox"
set :sidekiq_pid, File.join("#{shared_path}", 'pids', 'sidekiq.pid')
set :stage, :staging
server "#{fetch(:domain)}", user: "#{fetch(:user)}", roles: %w{web app db asset_syncer sidekiqer}