Skip to content

Instantly share code, notes, and snippets.

@ecpplus
ecpplus / ec2-ip-addresses.cr
Created May 7, 2020 08:11
コンパイル :
require "process"
require "json"
stdout = IO::Memory.new
stderr = IO::Memory.new
status = Process.run(
"aws",
%w|ec2 describe-instances --filters --region ap-northeast-1|,
output: stdout,
@ecpplus
ecpplus / keybase.md
Last active January 9, 2018 04:31
keybase.md

Keybase proof

I hereby claim:

  • I am ecpplus on github.
  • I am ecpplus (https://keybase.io/ecpplus) on keybase.
  • I have a public key whose fingerprint is 85B1 BBB0 6622 2606 693F A927 2D9F C4AF 031B 6E67

To claim this, I am signing this object:

@ecpplus
ecpplus / ViewController.swift
Created October 14, 2016 13:14
Connect to PhoenixFramework WebSocket from Swift.
import UIKit
import Starscream
class ViewController: UIViewController, WebSocketDelegate {
var socket = WebSocket(url: URL(string: "ws://10.0.1.2:4000/socket/websocket")!, protocols: [])
override func viewDidLoad() {
super.viewDidLoad()
socket.delegate = self
socket.connect()
@ecpplus
ecpplus / index.es6
Last active October 10, 2016 12:35
import m from 'mithril'
class Component {
constructor(props) {
this.props = props || {}
var component = this
this.controller = function() {
var ctrl = {}
component.init(ctrl)
@ecpplus
ecpplus / nginx.conf
Last active July 11, 2018 09:02
nginx.conf example for Phoenix Framework
upstream phoenix_server {
server localhost:4001;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
#! /bin/sh
mix deps.get --only prod
MIX_ENV=prod mix compile
# Compile assets
npm i
chmod +x node_modules/webpack/bin/*
NODE_ENV=production node_modules/webpack/bin/webpack.js -p
MIX_ENV=prod mix phoenix.digest
@import "bootstrap_variables.sass"
@import "bootstrap/scss/bootstrap.scss"
{
"presets": ["es2015", "react"]
}
@ecpplus
ecpplus / package.json
Created October 4, 2016 14:46
Phoenix Framework package.json example (use Bootstrap4, React)
{
"name": "Chat",
"version": "0.0.1",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"start": "webpack --watch-stdin --colors",
"compile": "webpack -p --colors"
@ecpplus
ecpplus / webpack.config.js
Created October 4, 2016 14:44
Phoenix Framework webpack config example
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const autoprefixer = require('autoprefixer');
const webpack = require('webpack');
const config = {
devtool: "source-map",
entry: {
"app": ["./web/static/css/app.sass", "./web/static/js/app.js"],
},