Skip to content

Instantly share code, notes, and snippets.

@vmlinz
vmlinz / dash-dev.md
Created October 28, 2015 16:14
Introduction to dash by IFTTT

DASH简介

DASH是由IFTTT不久前公布的一个开发环境设置工具,它使用了docker-compose,docker-machine和Ansible作为基础,安装非常简单,只需要执行它的bootstrap脚本就可以喝杯咖啡等它设置完成。

这个工具的主要功能是辅助开发容器化的应用程序,比如之前你使用了docker-compose配置过的项目,他能帮你配置本地的nginx和dnsmasq帮你把自定义域名重定向到你的应用,这样就可以不用在设置docker-compose的时候把nginx的单独配置放到docker-compose.yml里面。

准备

  • Homebrew with XCode Command Line Tools
  • Homebrew Cask
@vmlinz
vmlinz / osx-10.9-setup.md
Created October 29, 2015 04:35 — forked from kevinelliott/osx-10.9-setup.md
Clean Install – Mac OS X 10.9 Mavericks

Mac OS X 10.9 Mavericks

Custom recipe to get OS X 10.9 Mavericks running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install.

Install Software

The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.

Install from App Store

@vmlinz
vmlinz / tools.md
Last active April 12, 2017 20:01
Useful tools

Software tools collection

A list of useful tools

Virtual Machine

Security

// Bonfire: Exact Change
// Author: @vmlinz
// Challenge: http://www.freecodecamp.com/challenges/bonfire-exact-change?solution=function%20drawer(price%2C%20cash%2C%20cid)%20%7B%0A%20%20var%20cashes%20%3D%20%5B%5B%22PENNY%22%2C%200.01%5D%2C%20%5B%22NICKEL%22%2C%200.05%5D%2C%20%5B%22DIME%22%2C%200.10%5D%2C%20%5B%22QUARTER%22%2C%200.25%5D%2C%20%5B%22ONE%22%2C%201.00%5D%2C%20%5B%22FIVE%22%2C%205.00%5D%2C%20%5B%22TEN%22%2C%2010.00%5D%2C%20%5B%22TWENTY%22%2C%2020.00%5D%2C%20%5B%22ONE%20HUNDRED%22%2C%20100.00%5D%5D.reduce(function%20(hash%2C%20elem%2C%20index)%20%7B%0A%20%20%20%20hash%5Belem%5B0%5D%5D%20%3D%20elem%5B1%5D%3B%0A%20%20%20%20return%20hash%3B%0A%20%20%7D%2C%20%7B%7D)%3B%0A%20%20var%20change%3B%0A%20%20%2F%2F%20Here%20is%20your%20change%2C%20ma%27am.%0A%20%20var%20result%20%3D%20cash%20-%20price%3B%0A%20%20var%20total%20%3D%20cid.reduce(function%20(p%2C%20c)%20%7B%0A%20%20%20%20return%20p%20%2B%20c%5B1%5D%3B%0A%20%20%7D%2C%200.0).toFixed(2)%3B%0A%0A%20%20if%20(result%20%3E%20total)%0A%20%20%20%20return%20
@vmlinz
vmlinz / add_secure_token.rb
Last active December 3, 2015 16:20
rails carrierwave qiniu images
class User < ActiveRecord::Base
attr_accessor :upload_secure_token
...
end
@vmlinz
vmlinz / user.rb
Last active December 15, 2015 07:32
Rspec issue when testing user model
class User < ActiveRecord::Base
validates :auth_token, uniqueness: true
before_validation :downcase_email
before_create :generate_authentication_token!
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
def generate_authentication_token!
@vmlinz
vmlinz / prepare_eventmachine.sh
Last active December 24, 2015 02:53
Install eventmachine gem with brew installed open ssl
bundle config build.eventmachine --with-cppflags=\"-I/usr/local/opt/openssl/include\" --with-ldflags=\"-L/usr/local/opt/openssl/lib\"
@vmlinz
vmlinz / link.txt
Last active September 7, 2016 23:09
Deploy hexo site with travis
@vmlinz
vmlinz / rails_template_readme.md
Created January 6, 2016 04:00
rails template and best practices

CODESCRUM RAILS TEMPLATE

A base template for deploying Rails applications.

ESSENTIAL VERSIONS

The following versions are very important to keep in mind. We've done this because we think that the Ruby, Rails and ORM type and versions are the ones that apply the most constraints to a starter template.

  • Ruby 2.2.0