Skip to content

Instantly share code, notes, and snippets.

Keita ecpplus

View GitHub Profile
View ec2-ip-addresses.cr
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,
View 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 Oct 14, 2016
Connect to PhoenixFramework WebSocket from Swift.
View ViewController.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()
View index.es6
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 Jul 11, 2018
nginx.conf example for Phoenix Framework
View nginx.conf
upstream phoenix_server {
server localhost:4001;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
View start_prod.sh
#! /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
View gist:d83ff68b2c039f2895a7c3709406829d
@import "bootstrap_variables.sass"
@import "bootstrap/scss/bootstrap.scss"
View .babelrc
{
"presets": ["es2015", "react"]
}
@ecpplus
ecpplus / package.json
Created Oct 4, 2016
Phoenix Framework package.json example (use Bootstrap4, React)
View package.json
{
"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 Oct 4, 2016
Phoenix Framework webpack config example
View webpack.config.js
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"],
},
You can’t perform that action at this time.