Use with autorun, requires screen (/opt/screen).
適用於 S 牌的 NAS (需要裝 optware/screen、第三方套件 autorun),可以設定當外接 USB 裝置插入後,自動同步 NAS 內某目錄到 USB 裝置中。
- 把 script 用 autorun 設成自動執行就不用任何操作。
In vim, press CtrlZ and Enter on the end of line 12.
/* | |
* Usage exapmle: | |
* '[email protected]'.keyMatch('^(?<student_id>(?<identity_id>[bmd])(?<admission_year>\\d*)(?<admission_department_id>\\d{3})\\d{2})@mail\\.ntust\\.edu\\.tw$') | |
* | |
* The \ must be replaced as \\ in regex string. | |
*/ | |
String.prototype.keyMatch = function (re, flags) { | |
re = re.replace(/\(\?</gm, '(?P<'); |
ActiveAdmin.register_page "Preference" do | |
menu priority: 2 | |
content do | |
form :action => admin_preference_update_path, :method => :post do |f| | |
f.input :name => 'authenticity_token', :type => :hidden, :value => form_authenticity_token.to_s | |
panel "Preference" do | |
fieldset do | |
ol do | |
li do |
#!/bin/bash | |
echo "Copying assets from $1 to $2 ..." | |
find "$1/app/assets/javascripts" -mindepth 1 -maxdepth 1 ! -name "pages" ! -name "application.js" -exec cp -r {} "$2/app/assets/javascripts/" \; | |
find "$1/app/assets/stylesheets" -mindepth 1 -maxdepth 1 ! -name "pages" ! -name "application.css.scss" ! -name "_settings.scss" ! -name "_settings.scss.erb" -exec cp -r {} "$2/app/assets/stylesheets/" \; | |
cp -r "$1/app/assets/images/core" "$2/app/assets/images/" | |
cp -r "$1/app/views/layouts" "$2/app/views/" | |
cp -r "$1/app/views/partials" "$2/app/views/" |
<% flash.each do |type, message| %> | |
<p class="<%= type %>"><%= message %></p> | |
<% end %> |
<p class="user-actions"> | |
<% if current_user.blank? %> | |
<%= link_to("Sign In", new_user_session_path) %> | |
<%= link_to("Sign Up", new_user_registration_path) %> | |
<% else %> | |
Hello, <%= current_user.email %> | |
<%= link_to("Log Out", destroy_user_session_path, method: :delete) %> | |
<% end %> | |
</p> |
# https://gist.github.com/Neson/b90301900ed0d09ed4af | |
# http://jsfiddle.net/Neson/mgb0zgzo/ | |
{a, abbr, address, area, article, aside, audio, b, base, bdi, bdo, big, blockquote, body, br, button, canvas, caption, circle, cite, code, col, colgroup, data, datalist, dd, defs, del, details, dfn, div, dl, dt, ellipse, em, embed, fieldset, figcaption, figure, footer, form, g, h1, h2, h3, h4, h5, h6, head, header, hr, html, i, iframe, img, input, Objectinput, ins, kbd, keygen, label, legend, li, line, linearGradient, link, main, map, mark, mask, menu, menuitem, meta, meter, nav, noscript, object, ol, optgroup, option, output, p, param, path, pattern, polygon, polyline, pre, progress, q, radialGradient, rect, rp, rt, ruby, s, samp, script, section, select, small, source, span, stop, strong, style, sub, summary, sup, svg, table, tbody, td, text, textarea, tfoot, th, thead, time, title, tr, track, tspan, u, ul, video, wbr} = React.DOM | |
Input = React.createClass | |
getDefaultProps: -> | |
initialValue: '' | |
onChange: (v |
$("a[href*=#]:not([href=#])").click -> | |
if location.pathname.replace(/^\//, "") is @pathname.replace(/^\//, "") and location.hostname is @hostname | |
target = $(@hash) | |
target = (if target.length then target else $("[name=#{@hash.slice(1)}]")) | |
if target.length | |
$("html, body").animate | |
scrollTop: target.offset().top - 18 | |
, 1000 | |
false |