Skip to content

Instantly share code, notes, and snippets.

✔️
Verified

Cahyadi Triyansyah SunDi3yansyah

✔️
Verified
Block or report user

Report or block SunDi3yansyah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View countries.json
{
"response": {
"status": 200,
"message": "OK",
"url": "http://localhost:3000/api/v1/mixed/countries"
},
"data": [
{
"country_data_or_code": {
"continent": "South America",
@SunDi3yansyah
SunDi3yansyah / README.md
Last active Sep 5, 2019 — forked from niallo/gist:3109252
Parse Github `Links` header in JavaScript
View README.md
/*
 * 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 / README.md
Created Aug 18, 2019
Rails disable Active Storage
View README.md

config/application.rb

require "active_storage/engine"

config/environments/*.rb

config.active_storage.service = :local
@SunDi3yansyah
SunDi3yansyah / postman.desktop
Created Aug 17, 2019
Postman launcher desktop
View postman.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Postman
Icon=/home/sundi3yansyah/Src/postman/app/resources/app/assets/icon.png
Path=/home/sundi3yansyah/Src/postman
Exec=/home/sundi3yansyah/Src/postman/Postman
StartupNotify=false
StartupWMClass=Postman
@SunDi3yansyah
SunDi3yansyah / images_controller.rb
Created Aug 17, 2019
Example API for upload image in QuillJS
View images_controller.rb
class ImagesController < ActionController::Base
skip_before_action :verify_authenticity_token
def create
@image = Image.new(image_params)
if @image.save
render json: { url: @image.image_url(:original) }, status: 201
else
render json: { message: @image.errors.full_messages.first }, status: 422
View README.md
chown -R $(whoami) ~/.gnupg
find ~/.gnupg -type f -exec chmod 600 {} \;
find ~/.gnupg -type d -exec chmod 700 {} \;
@SunDi3yansyah
SunDi3yansyah / db.rake
Created Aug 14, 2019 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
View db.rake
# 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 / README.md
Created Aug 13, 2019
MX Record for GSuite
View README.md
MX   1    aspmx.l.google.com.
MX   5    alt1.aspmx.l.google.com.
MX   5    alt2.aspmx.l.google.com.
MX   10   alt3.aspmx.l.google.com.
MX   10   alt4.aspmx.l.google.com.
TXT  "v=spf1 a mx ~all"
@SunDi3yansyah
SunDi3yansyah / README.md
Created Aug 13, 2019
Add/Remove User MySQL / MariaDB (Common)
View README.md

Add User Spesification Database

CREATE USER 'STRING-USER'@'localhost' IDENTIFIED BY 'STRING-PASSWORD';
grant ALL PRIVILEGES ON STRING-DATABASE.* TO 'STRING-USER'@'localhost';
FLUSH PRIVILEGES;
\q

Add User Anything Database

@SunDi3yansyah
SunDi3yansyah / github_gpg_key.md
Created Aug 13, 2019 — forked from ankurk91/github_gpg_key.md
Github : Signing commits using GPG (Ubuntu/Mac)
View github_gpg_key.md

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/
You can’t perform that action at this time.