$ npm init
$ npm i --no-optional -D webpack webpack-cli typescript ts-loader
$ npm i -S react react-dom @types/react @types/react-domAdd webpack config to scripts of package.json.
{| func logRun() { | |
| //ctx := context.Background() | |
| replace := func(groups []string, a slog.Attr) slog.Attr { | |
| switch { | |
| case a.Key == slog.MessageKey: | |
| return slog.Attr{Key: "message", Value: a.Value} | |
| case a.Key == slog.LevelKey: | |
| if l := a.Value.Any().(slog.Level); l == slog.LevelWarn { | |
| return slog.String("severity", "WARNING") | |
| } |
| version: '3' | |
| services: | |
| # Spanner | |
| spanner-emulator: | |
| image: gcr.io/cloud-spanner-emulator/emulator | |
| ports: | |
| - "9010:9010" | |
| - "9020:9020" |
$ npm init
$ npm i --no-optional -D webpack webpack-cli typescript ts-loader
$ npm i -S react react-dom @types/react @types/react-domAdd webpack config to scripts of package.json.
{| import 'dart:io'; | |
| import 'dart:async'; | |
| import 'dart:convert'; | |
| import 'package:csv/csv.dart'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:flutter/services.dart' show rootBundle; | |
| class Product { | |
| const Product({this.name}); | |
| final String name; |
| # Put spec/support/capybara-finders_tap.rb | |
| # Target: capybara 2.0.3 | |
| module Capybara | |
| module Node | |
| module Finders | |
| # Usage: | |
| # find('div.foo1'){|x| puts x.to_s } | |
| # | |
| def find_with_tap(*args) | |
| if block_given? |
| - (void)setBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state | |
| { | |
| CGRect rect = CGRectMake(0, 0, 1, 1); | |
| UIGraphicsBeginImageContext(rect.size); | |
| CGContextRef context = UIGraphicsGetCurrentContext(); | |
| CGContextSetFillColorWithColor(context, backgroundColor.CGColor); | |
| CGContextFillRect(context, rect); | |
| UIImage *backgroundImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); |
| #!/bin/sh | |
| # | |
| # chkconfig: - 88 12 | |
| # | |
| # init.d script for single or multiple unicorn installations. Expects at least one .env | |
| # file in /etc/unicorn | |
| # | |
| ## A sample /etc/unicorn/production.env | |
| ## | |
| ## RAILS_ENV=production |
| # check passenger. | |
| $ gem list | grep passenger | |
| # if it is missing, install. | |
| $ gem install passenger | |
| # download new version nginx. | |
| $ wget http://nginx.org/download/nginx-1.0.11.tar.gz | |
| $ tar -zxf nginx-1.0.11.tar.gz |
| # if you wanna use syslog, you can rewrite by syslogger. | |
| if Rails.env.production? | |
| module Delayed::Backend::ActiveRecord | |
| class Job | |
| class << self | |
| def after_fork | |
| logger = Syslogger.new("#{Rails.env}.delayed_job", Syslog::LOG_PID, Syslog::LOG_LOCAL2) | |
| Rails.logger = logger | |
| Delayed::Worker.logger = logger | |
| # can't call super |