Skip to content

Instantly share code, notes, and snippets.

View CasperLaiTW's full-sized avatar
🏠
Working in home

Casper Lai CasperLaiTW

🏠
Working in home
  • VoH inc.
  • Taichung, Taiwan
View GitHub Profile
module ViewHelpers
def rel_stylesheet_link_tag(*f)
styles=stylesheet_link_tag *f
script_path = self.parser.script_filename.gsub(Compass.configuration.project_path, '')
child_folder= File.dirname( script_path.gsub(/\/[^\/]+/, '/..')[1..-1] )
styles.gsub 'href="', "href=\"#{child_folder}"
end
def rel_javascript_include_tag(*f)
styles=javascript_include_tag *f
@CasperLaiTW
CasperLaiTW / view_helpers.rb
Last active August 29, 2015 14:01
Extend fireapp viewhelper
# This method is base on fireapp docs example.
# The url will join {http_path} variable.
module ViewHelpers
def new_link_to(name, href, options={})
href = ensure_path(href, '')
if href == File.join(Helpers::Path.get_http_path, request.path)
options[:class] ||=''
options[:class] += "active"
end
link_to name, href, options
@CasperLaiTW
CasperLaiTW / auto-start-ssh-agent
Created March 27, 2015 01:59
Auto start ssh agent. Please put code to .bashrc, maybe first login will notice you to type id_rsa password.
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
@CasperLaiTW
CasperLaiTW / Button Template Example.md
Last active December 16, 2016 17:57
Messenger webview bug
curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"USER_ID"
  },
  "message":{
    "attachment":{
      "type":"template",
      "payload":{
 "template_type":"button",
@CasperLaiTW
CasperLaiTW / laravel-forge-ngx-pagespeed.sh
Last active July 9, 2024 10:31
Laravel Forge Support NGX_PAGESPEED
PAGESPEED_VERSION=v1.12.34.2-stable
apt-get remove nginx nginx-full -y
apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev -y
sed -i "s/# deb-src/deb-src/" /etc/apt/sources.list.d/nginx-ubuntu-development-xenial.list
apt-get update
apt-get build-dep nginx -y
cd /tmp
apt-get source nginx
@CasperLaiTW
CasperLaiTW / fix-timezone-vuetify.min.js
Created October 24, 2017 08:28
fix-timezone-vuetify.min.js
/*!
* Vuetify v0.16.4
* Forged by John Leider
* Released under the MIT License.
*/
!(function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Vuetify=e():t.Vuetify=e()})(this,(function(){return (function(t){function e(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=5)})([(function(t,e){}),(function(t,e){}),(function(t,e){}),(function(t,e){}),(function(t,e){}),(function(t,e,i){"use strict";function n(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(document._loadCallbacks||(document._loadCallbac