This file contains hidden or 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'; | |
angular.module('calenshareApp') | |
.factory('GoogleAuth', function () { | |
(function() { | |
var po = document.createElement('script'); | |
po.type = 'text/javascript'; po.async = true; | |
po.src = 'https://apis.google.com/js/client:plusone.js?onload=render'; | |
var s = document.getElementsByTagName('script')[0]; | |
s.parentNode.insertBefore(po, s); |
This file contains hidden or 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
# method 1 | |
pmset -g batt | sed -n 2p | awk -F "[\t;%]" '{ print $2 }' | |
# method 2 | |
brew tap Goles/battery | |
brew install battery | |
battery | awk -F "[\\\[\\\]%]" '{ print $3 }' | |
# method 3 | |
wget --no-check-certificate https://raw.githubusercontent.com/richo/battery/master/bin/battery |
This file contains hidden or 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 util = require('util'), | |
request = require('request'), | |
parser = require('xml2json'), | |
calendar_id = '[email protected]', | |
api_key = 'AIzaSyBQal2rNhP5SRkU5hZytY7Yb8nYc5Q1nrc', | |
url = util.format('https://www.googleapis.com/calendar/v3/calendars/%s/events?key=%s', calendar_id, api_key); | |
request({url: url}, function(error, response, json){ | |
var data = JSON.parse(json), | |
transformed = data.items.map(function(event){ |
This file contains hidden or 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
(defmacro log-form-with-value (&body body) | |
"records the body form, and the form's return value | |
to the list *log-with-value* and then evalues the body normally" | |
`(let ((logform nil) | |
(retval ,@body)) | |
;; 有沒有不需要list的解法? 試不出來QQ | |
(push (list :form ',@body :value retval) *log-with-value*) | |
retval)) |
This file contains hidden or 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
(defun score (dice) | |
(let ((dice (sort dice #'>))) | |
(flet ((is-1-or-5 (x) | |
(or (= x 1) (= x 5))) | |
(triple-p (dice) | |
(and (= (length dice) 3) (apply #'= dice))) | |
(triple-score (dice) | |
(if (= (first dice) 1) | |
1000 | |
(* 100 (first dice))))) |
This file contains hidden or 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
#!/bin/bash | |
sbcl --script contemplate.lsp | tail -n 13 \ | |
| sed "s/INCOMPLETE/`tput setaf 6`INCOMPLETE`tput sgr0`/g" \ | |
| sed "s/FAIL/`tput setaf 1`FAIL`tput sgr0`/g" \ | |
| sed "s/PASS/`tput setaf 2`PASS`tput sgr0`/g" | |
# 未完成=青色 | |
# 失敗=紅色 | |
# 通過=綠色 |
This file contains hidden or 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
;; auto compile jade file after save | |
(add-hook | |
'after-save-hook | |
(lambda () | |
(if (string= (file-name-extension (buffer-file-name)) "jade") | |
(if (= (shell-command | |
(concat "jade --pretty " (buffer-file-name))) | |
0) | |
(message (concat (buffer-file-name) " just saved and compiled into html")))))) |
This file contains hidden or 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
angular.module('myApp', ['ui.state']). | |
provider('pathRoot', function() { | |
return { | |
partialView: function(filename) { | |
return '../js/angular/partial/' + filename; | |
}, | |
$get: function(pathId) { | |
return {}; | |
} | |
}; |
NewerOlder