Skip to content

Instantly share code, notes, and snippets.

@loddit
loddit / who_using_your_stage.html
Last active November 5, 2016 21:26
parse deploy.log to show who using your stage
<html>
<head>
<title>Who Is Using Your Stage?</title>
<style>
* {
transition: all .2s linear;
}
body {
background-color: #333;
margin: 0;
@loddit
loddit / bye_joy.bookmarklet
Last active July 13, 2016 07:25
bye joy emoji bookmarklet
document.body.appendChild(document.createElement("style")).innerHTML = `.emoji-inner[style="background: url(https://dn-linedesigner.qbox.me/sheet_apple_64.png);background-position:65% 40%;background-size:4100%"]{visibility: hidden;}`;
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
function fpr ()
{
sha1="$1"
diff --git a/src/ngRoute/route.js b/src/ngRoute/route.js
index 4ecc932..2041300 100644
--- a/src/ngRoute/route.js
+++ b/src/ngRoute/route.js
@@ -580,7 +580,7 @@ function $RouteProvider(){
if (i === 0) {
result.push(segment);
} else {
- var segmentMatch = segment.match(/(\w+)(.*)/);
+ var segmentMatch = segment.match(/(\w+)\??(.*)/);
@loddit
loddit / unobtrusive.js
Created May 11, 2012 05:57
![更新了 csrf 检查] 对几个属性进行了包装 data-method(用于a标签可以POST,和模拟DELETE,PUT) data-disable-with(按钮点下后设置disable) data-remote(发起ajax请求)
jQuery(function ($) {
var csrf_token = $('meta[name=csrf-token]').attr('content'),
csrf_param = $('meta[name=csrf-param]').attr('content');
$.fn.extend({
triggerAndReturn: function (name, data) {
var event = new $.Event(name);
this.trigger(event, data);