Skip to content

Instantly share code, notes, and snippets.

View zainalmustofa's full-sized avatar
🎯
Focusing

zainal mustofa zainalmustofa

🎯
Focusing
View GitHub Profile
@kiddtang
kiddtang / .env
Last active January 30, 2024 21:12
Host WordPress on your Win 11 / 10 with Free Docker Desktop
MYSQL_ROOT_PASSWORD=your_root_password
MYSQL_USER=your_wordpress_database_user
MYSQL_PASSWORD=your_wordpress_database_password
@maxivak
maxivak / webpacker_rails.md
Last active April 13, 2023 18:46
Webpack, Yarn, Npm in Rails
@cprakashagr
cprakashagr / LICENCE SUBLIME TEXT
Last active May 1, 2024 10:50
Sublime Text 3 Serial key build is 3143
## Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
@randallreedjr
randallreedjr / heroku-remote.md
Last active April 25, 2024 07:06
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
@mada41
mada41 / application_controller.rb
Created June 1, 2016 04:21
Handle missing unknown format
class ApplicationController < ActionController::Base
rescue_from ActionController::UnknownFormat, :with => :render_not_found
private
def render_not_found
respond_to do |format|
format.any { render :text => "sorry, not found" }
format.all { render :text => "sorry, not found"}
end
end
@indiesquidge
indiesquidge / subdomain-localhost-rails-5.md
Created January 19, 2016 07:42
how to access subdomains locally with Rails 5

Subdomaining Localhost with Rails 5

I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api

Rails.application.routes.draw do
  constraints subdomain: "api" do
    scope module: "api" do
@ahimmelstoss
ahimmelstoss / listings_controller_spec.rb
Last active April 6, 2017 21:03
spec for listings controller
require 'rails_helper'
RSpec.describe ListingsController, :type => :controller do
render_views
let(:json) { JSON.parse(response.body) }
describe "GET /listings.json" do
before do
get :index, format: :json
@Bijendra
Bijendra / upload-images-s3-sdk-ruby
Last active May 30, 2023 08:20
Upload images to AWS S3 in rails application using aws-sdk
Using gem aws-sdk for a ror application for uploading images to s3
Uploading images to a fixed bucket with different folders for each object or application.
The s3 keeps a limitation on the number of buckets creattion whereas there is no
limitation for content inside a bucket.
This code will upload image for a user to s3 using aws-sdk gem. The bucket and the image uploaded are made public
so that the images uploaded are directly accessible. The input it takes is the image complete path
where it is present, folder in which it should be uploaded and user_id for whom it should
be uploaded.
@alex-zige
alex-zige / gist:5795358
Last active June 8, 2023 07:49
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@galulex
galulex / install.md
Last active February 28, 2021 14:15
Ruby On Rails Ubuntu 18.04 install

Developer libs

mysql, rmagic, curl, git, vim, sqlite, nodejs nokogiri...

sudo apt-get install libxslt1-dev libxml2-dev build-essential patch libsqlite3-dev libcurl4-openssl-dev curl git git-gui vim-gtk exuberant-ctags nodejs rar

Ruby

sudo apt-add-repository ppa:brightbox/ruby-ng

sudo apt-get update