This gist will collects all issues we solved with Rails 5.2 and Webpacker
# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
class TimeEntriesController < ApplicationController | |
before_action :set_project, :set_issue | |
def create | |
@time_entry = container.time_entries.build time_entry_params.merge(user: User.current) | |
if @time_entry.save | |
respond_to do |format| | |
format.html { redirect_back_or_default created_time_entry_url, notice: l(:notice_successful_create) } | |
format.api { render :show, status: :created, location: @time_entry } |
#!/bin/bash | |
rm -rf *.o *.[568] test_* |
location / { | |
if ($uri ~* "/assets/.*-(.*)\..*") { | |
expires max; | |
add_header Cache-Control public | |
add_header Etag $1; | |
} | |
} |
module Parsing | |
/// Remember where we are in the code. | |
/// This is a struct to keep memory pressure down. | |
/// (Significant perf improvements on iOS.) | |
type ParseState = | |
struct | |
val Code : string | |
val Index : int | |
new (code : string, index : int) = |
@import MobileCoreServices; | |
static CFStringRef UTTypeForImageData(NSData *data) { | |
const unsigned char * bytes = [data bytes]; | |
if (data.length >= 8) { | |
if (bytes[0] == 0x89 && bytes[1] == 0x50 && bytes[2] == 0x4E && bytes[3] == 0x47 && bytes[4] == 0x0D && bytes[5] == 0x0A && bytes[6] == 0x1A && bytes[7] == 0x0A) { | |
return kUTTypePNG; | |
} | |
} |
# Encoding: utf-8 | |
# | |
# idle.rb | |
# | |
# goal: | |
# Ruby script to test how to fetch IMAP mails with IDLE mode. | |
# IMAP IDLE allow a sort of "push" / "real-time" delivery. | |
# | |
# I used the script to test LATENCY (end-to-end delivery times) |
class Saga | |
class << self | |
def with_redis; raise NotImplementedError; end | |
attr_accessor :cleanup_delay, :queue, :last_txid | |
def queue | |
Thread.current[:saga_queue] ||= [] | |
end | |
def last_txid |
This gist will collects all issues we solved with Rails 5.2 and Webpacker
# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |