This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+----------------------------+----------------------+-------------+----------------+----------------+ | |
| | | | | | | |
| Helper | GET | POST | PUT | DELETE | | |
| | | | | | | |
+----------------------------+----------------------+-------------+----------------+----------------+ | |
| | | | | | | |
| blog_post_path(@post) | /blog/posts/12 | | /blog/posts/12 | /blog/posts/12 | | |
| | | | | | | |
+----------------------------+----------------------+-------------+----------------+----------------+ | |
| | | | | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = /^(?:(?:ht|f)tp(?:s?)\:\/\/|~\/|\/)?(?:\w+:\w+@)?((?:(?:[-\w\d{1-3}]+\.)+(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|edu|co\.uk|ac\.uk|it|fr|tv|museum|asia|local|travel|[a-z]{2}))|((\b25[0-5]\b|\b[2][0-4][0-9]\b|\b[0-1]?[0-9]?[0-9]\b)(\.(\b25[0-5]\b|\b[2][0-4][0-9]\b|\b[0-1]?[0-9]?[0-9]\b)){3}))(?::[\d]{1,5})?(?:(?:(?:\/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|\/)+|\?|#)?(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=?(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=?(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?:#(?:[-\w~!$ |\/.,*:;=]|%[a-f\d]{2})*)?$/i | |
, chinese = /[\u4e00-\u9fa5]+/ | |
, cText = '中文https://github.com/夾雜網址。' | |
, eText = 'english https://github.com/ url.' | |
, mixText = '中 en 文https://github.com/夾雜 google.com網址' | |
, gResult; | |
// utilities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var app = angular.module('app', []); | |
app.controller('AppCtrl', function ($scope) { | |
this.foo = 'bar'; | |
$scope.hello = 'world'; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<test data-test=" 'hello' "></test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.app = angular.module('myApp', []); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run (input) | |
tell application "Google Chrome" | |
set theURL to URL of active tab of first window | |
set theTitle to title of active tab of first window | |
set theData to theTitle & " " & theURL & " #「" & input & "」" as string | |
end tell | |
activate application "Tweetbot" | |
tell application "System Events" to tell process "Tweetbot" | |
click menu item "New Tweet" of menu 1 of menu bar item "Tweet" of menu bar 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 英文、數字、符號:[a-z0-9~!@#&;=_\$\%\^\*\-\+\,\.\/(\\)\?\:\'\"\[\]\(\)] | |
// 中文:\u4e00-\u9fa5 | |
// 日文:\u3040-\u30FF | |
var string = "中文內容" | |
string.match(/[\u4e00-\u9fa5]+/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :dev do | |
desc "Rebuild system" | |
task :build => ["tmp:clear", "log:clear", "db:drop", "db:create", "db:migrate"] | |
task :rebuild => [ "dev:build", "db:seed" ] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Automaticlly install pptpd on Amazon EC2 Amazon Linux | |
# | |
# Ripped from http://blog.diahosting.com/linux-tutorial/pptpd/ | |
# pptpd source rpm packing by it's authors | |
# | |
# WARNING: | |
# first ms-dns setting to 172.16.0.23, 172.16.0.23 was showing on my | |
# /etc/resolv.conf, I'm not sure this is the same on all Amazon AWS zones. | |
# | |
# You need to adjust your "Security Groups" which you are using too. |