Skip to content

Instantly share code, notes, and snippets.

View SunDi3yansyah's full-sized avatar
Verified

Cahyadi Triyansyah SunDi3yansyah

Verified
View GitHub Profile
@SunDi3yansyah
SunDi3yansyah / config.yml
Last active March 26, 2020 13:35 — forked from seratch/config.yml
AWS SQS Example
access_key_id: xxx
secret_access_key: yyy
@SunDi3yansyah
SunDi3yansyah / main.yaml
Created February 26, 2020 11:54 — forked from ArturT/main.yaml
GitHub Actions - how to run parallel tests in RSpec for Ruby on Rails project. See article how to run RSpec on GitHub Actions for Ruby on Rails app using parallel jobs https://docs.knapsackpro.com/2019/how-to-run-rspec-on-github-actions-for-ruby-on-rails-app-using-parallel-jobs or sign up at https://knapsackpro.com/?utm_source=github&utm_medium=…
# .github/workflows/main.yaml
name: Main
on: [push]
jobs:
vm-job:
runs-on: ubuntu-latest
# If you need DB like PostgreSQL then define service below.
@SunDi3yansyah
SunDi3yansyah / post_xml.rb
Created December 15, 2019 06:08 — forked from mattriley/post_xml.rb
Ruby HTTP POST request containing XML content
require 'net/http'
def post_xml url_string, xml_string
uri = URI.parse url_string
request = Net::HTTP::Post.new uri.path
request.body = xml_string
request.content_type = 'text/xml'
response = Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }
response.body
end
@SunDi3yansyah
SunDi3yansyah / force-remove-json-183.sh
Created November 28, 2019 13:35 — forked from rubyisbeautiful/force-remove-json-183.sh
Force removal of (default) gem son 1.8.3
#!/bin/bash
mv /apps/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/specifications/default/json-1.8.3.gemspec /apps/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/specifications
gem uninstall json -v '1.8.3'
echo "done!"
@SunDi3yansyah
SunDi3yansyah / README.md
Last active September 5, 2019 05:21 — forked from niallo/gist:3109252
Parse Github `Links` header in JavaScript
/*
 * parse_link_header()
 *
 * Parse the Github Link HTTP header used for pageination
 * http://developer.github.com/v3/#pagination
 */
function parse_link_header(header) {
  if (header.length == 0) {
 throw new Error("input must not be of zero length");
@SunDi3yansyah
SunDi3yansyah / db.rake
Created August 14, 2019 11:12 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@SunDi3yansyah
SunDi3yansyah / github_gpg_key.md
Created August 13, 2019 06:49 — forked from ankurk91/github_gpg_key.md
Github : Signing commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github account ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/
@SunDi3yansyah
SunDi3yansyah / app.DockerFile
Created August 7, 2019 11:01 — forked from satendra02/app.DockerFile
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/app_name
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran:
@SunDi3yansyah
SunDi3yansyah / ruby_on_rails_deployment.md
Created August 7, 2019 10:24 — forked from zentetsukenz/ruby_on_rails_deployment.md
Deploy Ruby on Rails application with Docker Compose and Capistrano with ease

#Docker

##Files and Folders.

|
|\_ app
|...
|\_ docker
| |
@SunDi3yansyah
SunDi3yansyah / elasticsearch.rake
Created July 11, 2019 14:12 — forked from jarosan/elasticsearch.rake
Elasticsearch reindex task
# Run with: rake environment elasticsearch:reindex
namespace :elasticsearch do
desc "re-index elasticsearch"
task :reindex => :environment do
klass = Place
ENV['CLASS'] = klass.name
ENV['INDEX'] = new_index = klass.tire.index.name << '_' << Time.now.strftime('%Y%m%d%H%M%S')