Skip to content

Instantly share code, notes, and snippets.

@stinger
stinger / Swift3Dates.swift
Last active May 21, 2018 02:04
Swift 3: Working with dates
//: # Swift 3: Working with dates
import Foundation
let date = Date()
let myLocale = Locale(identifier: "bg_BG")
//: ### Setting an application-wide `TimeZone`
//: Notice how we use if-let in case the abbreviation is wrong. It will fallback to the default timezone in that case.
if let myTimezone = TimeZone(abbreviation: "EEST") {
print("\(myTimezone.identifier)")
@edvakf
edvakf / 社内ISUCON事前ハンズオン.md
Last active April 30, 2023 13:12
ピクシブで新卒エンジニア全員向けに「インフラ研修」として次の内容のハンズオン講義を行いました。ちょうど2時間で終わる内容になっています。新卒達にはこの直後に社内ISUCONに挑んでもらいました。

AWSにインスタンスを立ててみよう

  • 質問:AWSにEC2インスタンスを立てたことがある人?
    • AWSのアカウント持ってない人はこの機会に取得してみよう
    • クレカがない人は言ってください
  • AWSにログインしてみよう https://portal.aws.amazon.com/
    • 東京リージョンに変更してみよう
  • Debian Jessieのインスタンスを起動してみよう
    • Rubyビルド済みインスタンスを用意しました
  • サイドバーのAMIから、検索欄に ami-53021a3d と書いて「パブリックイメージ」を選択
# bashを起動するときに読み込まれる設定ファイル
PATH=$PATH:$HOME/local/bin
# /etc/nginx/nginx.conf
http {
# http://www.xmisao.com/2014/05/09/fluentd-elasticsearch-nginx-log.html
log_format ltsv 'time:$time_iso8601\t'
'remote_addr:$remote_addr\t'
'request_method:$request_method\t'
'request_length:$request_length\t'
'request_uri:$request_uri\t'
'https:$https\t'
@edvakf
edvakf / php.conf
Last active April 28, 2016 02:07
nginx conf
# /etc/nginx/sites-enabled/php.conf
server {
listen 80;
server_name php.aws;
root /var/www/html;
location / {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
# sudo vi /etc/systemd/system/rack-test.service
[Unit]
Description=rack-test
After=syslog.target
[Service]
User=admin
Group=admin
WorkingDirectory=/home/admin/rack-test
Environment=PATH=/usr/local/bin:/usr/bin:/bin:/home/admin/local/bin
# apache2を再起動
sudo systemctl restart apache2
# apache2の設定を再読み込み
sudo systemctl reload apache2
# apache2を止める
sudo systemctl stop apache2
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@jonah-williams
jonah-williams / tap.swift
Last active October 31, 2020 14:37
Implementing a Ruby `tap` equivalent in Swift
// I wanted an equivalent to Ruby's `tap` (http://ruby-doc.org/core-2.3.0/Object.html#method-i-tap) in Swift which I could mix into any type to tap into method chains.
// Define the interface we want to provide as a protocol
private protocol Tap {
func tap(block: (Self) -> Void) -> Self
}
// Extend the `Tap` protocol with a default implementation
private extension Tap {
func tap(block: (Self) -> Void) -> Self {
@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"