Skip to content

Instantly share code, notes, and snippets.

View chrisun's full-sized avatar

Chris Sun chrisun

View GitHub Profile
before_save :do_something
def do_something
self.attr_c = self.attr_a < self.attr_b
end
@chrisun
chrisun / gist:834967
Created February 19, 2011 09:40
Create/Update without triggering callbacks - Rails 2.x only
ar.send(:create_without_callbacks)
ar.send(:update_without_callbacks)
msg.sent_at.strftime("%m/%d/%Y @ %I:%M%p %Z")
@chrisun
chrisun / gist:1807164
Created February 12, 2012 08:00
Node name in Chef recipe
Chef::Config[:node_name]
@chrisun
chrisun / gist:2bc7f31943e1ba346bc5
Last active August 29, 2015 14:01
Make a Datagrid column into a link
class PostsGrid
include Datagrid
scope do
Post
end
column(:id)

Keybase proof

I hereby claim:

  • I am chrisun on github.
  • I am chrisun (https://keybase.io/chrisun) on keybase.
  • I have a public key whose fingerprint is 4486 7525 F298 7D43 4040 7F41 E702 F757 A853 9265

To claim this, I am signing this object:

@chrisun
chrisun / app.DockerFile
Created May 3, 2020 17:22 — 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: