warning: ignoring broken ref refs/remotes/origin/HEAD
➜ ✗ g symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/develop
➜ ✗ g fetch --prune
➜ ✗ g gc
| <?php | |
| // For laravel 5 based systems | |
| // /path/to/project/app/Console/Commands/AllowSSHFromIP.php | |
| namespace App\Console\Commands; | |
| use Aws\Ec2\Ec2Client; | |
| use Carbon\Carbon; | |
| use Illuminate\Console\Command; |
| # config/initializers/activestorage.rb | |
| Rails.application.config.to_prepare do | |
| # Provides the class-level DSL for declaring that an Active Record model has attached blobs. | |
| ActiveStorage::Attached::Macros.module_eval do | |
| def has_one_attached(name, dependent: :purge_later, acl: :private) | |
| class_eval <<-CODE, __FILE__, __LINE__ + 1 | |
| def #{name} | |
| @active_storage_attached_#{name} ||= ActiveStorage::Attached::One.new("#{name}", self, dependent: #{dependent == :purge_later ? ":purge_later" : "false"}, acl: "#{acl}") | |
| end |
| # Ruby CircleCI 2.0 configuration file | |
| # | |
| # Check https://circleci.com/docs/2.0/language-ruby/ for more details | |
| # | |
| defaults: &defaults | |
| working_directory: ~/repo | |
| docker: | |
| - image: circleci/ruby:2.4.1-node-browsers | |
| environment: |
| version: 2 | |
| jobs: | |
| build: | |
| docker: | |
| - image: circleci/openjdk:8-jdk | |
| steps: | |
| - checkout | |
| - setup_remote_docker | |
| - run: | |
| name: install aws |
| activerecord: | |
| attributes: | |
| address: | |
| phone: "Phone" | |
| name: "Street Name" | |
| line1: "Address line 1" | |
| city: "Address line 2" | |
| state: "State" | |
| country: "Country" | |
| pincode: "Pincode" |
| #!/bin/bash -e | |
| ## | |
| # Use this annotated script a base for launching an interactive console task on Amazon ECS | |
| # | |
| # more info: https://engineering.loyaltylion.com/running-an-interactive-console-on-amazon-ecs-c692f321b14d | |
| # | |
| # Requirements: | |
| # - `jq` must be installed on both the client and server | |
| ## |
warning: ignoring broken ref refs/remotes/origin/HEAD
➜ ✗ g symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/develop
➜ ✗ g fetch --prune
➜ ✗ g gc
| http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
| http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
| #payload: [{"kind"=>"person"}] | |
| Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
| #data: {"interest"=>["music", "movies", "programming"]} | |
| Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
| Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
| Segment.where("jsonb_array_length(data->'interest') > 1") |
NOTICE: When I say "appname" it means enter your own! It's not a command or name native to git or Heroku.
By default, your one and only remote is called "heroku". This is why you do things like $ git push heroku master, you're pushing to the master branch of heroku. What we want is two remotes: one staging, one production. You can view your remotes by typing...
$ heroku apps:create staging-appname
$ git remote -v
// this should return:
// heroku [email protected]:appname.git (fetch)
// heroku [email protected]:appname.git (push)
So, lets rename that default heroku git remote to a staging, production one.
| # AWS SDK | |
| require 'aws-sdk' | |
| Aws::EC2::Resource | |
| # Load DSL and set up stages | |
| require "capistrano/setup" | |
| # Include default deployment tasks | |
| require "capistrano/deploy" | |
| require 'capistrano/safe_deploy_to' |