Skip to content

Instantly share code, notes, and snippets.

View trandaison's full-sized avatar

Son Tran trandaison

View GitHub Profile
require 'formula'
class Varnish3 <Formula
url 'https://varnish-cache.org/_downloads/varnish-3.0.2.tgz'
homepage 'http://www.varnish-cache.org/'
sha256 '973f60625e9690e0989e1bbc73c37ea53fc6291b8f7b03d617b76f8084a4a243'
depends_on 'pkg-config' => :build
depends_on 'pcre' => :build
@trandaison
trandaison / excel_xlsx_schema.xml
Created September 11, 2017 01:38
MS Office schema
<?xml version="1.0"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>Microsoft Office User</Author>
<LastAuthor>Microsoft Office User</LastAuthor>
<Created>2017-09-11T01:32:10Z</Created>
@trandaison
trandaison / rspec_rails_cheetsheet.rb
Created September 12, 2017 07:25 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@trandaison
trandaison / rspec_rails_cheetsheet.rb
Created September 12, 2017 07:25 — forked from redrick/rspec_rails_cheetsheet.rb
New expect syntax + new hash syntax and couple corrections
#Model
expect(@user).to have(1).error_on(:username) # Checks whether there is an error in username
expect(@user.errors[:username]).to include("can't be blank") # check for the error message
#Rendering
expect(response).to render_template(:index)
#Redirecting
expect(response).to redirect_to(movies_path)
@trandaison
trandaison / mysql.md
Created April 10, 2018 07:43
Install mysql on MacOSX

Install mysql via HomeBrew

$ brew install mysql

To have launchd start mysql at login

$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ brew services start mysql
# or
@trandaison
trandaison / geotool.js
Created June 15, 2018 04:06 — forked from Craftworks/geotool.js
測地系変換ライブラリ(WGS <=> TKY, degree <=> dms)
//------------------------------------------------------------------------------
// geotool.js - version 1.0.0
//
// Copyright (c) 2005 Craftworks Corp. All Right Reserved.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
@trandaison
trandaison / default.conf
Created August 30, 2018 13:54
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
@trandaison
trandaison / upload.js
Created October 7, 2018 12:40 — forked from virolea/upload.js
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round( (progressEvent.loaded * 100) / progressEvent.total )
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@trandaison
trandaison / scripts.js
Created December 17, 2018 01:03
Redmine Toggle sidebar
var button = document.createElement('div');
button.innerHTML = '>';
button.setAttribute('id', 'sidbar-collapse');
var sidebar = document.getElementById('sidebar');
button.onclick = () => {
sidebar.classList.toggle('collapse');
button.innerHTML = button.innerText == '>' ? '<' : '>';
};
sidebar.appendChild(button);
button.click();
@trandaison
trandaison / script.js
Created March 18, 2019 01:28
Redmine hide sidebar
var toggle = document.createElement('div');
var sidebar = document.getElementById('sidebar');
toggle.innerHTML = '>';
toggle.classList.add('toggle-sidebar');
toggle.classList.add('open');
toggle.addEventListener('click', function() {
sidebar.classList.toggle('hidden');
toggle.classList.toggle('open');
setTimeout(function() {
toggle.innerHTML = sidebar.classList.contains('hidden') ? '<' : '>';