atomita
2015-3-19
| <?php | |
| function get_twitter_bearer_token($api_key, $api_secret){ | |
| $credential = base64_encode($api_key . ':' . $api_secret); | |
| $data = [ | |
| 'grant_type' => 'client_credentials' | |
| ]; | |
| $data = http_build_query($data, "", "&"); |
| <?php | |
| function array_flatten($arr, $level = null){ | |
| $_arr = array(); | |
| if (is_int($level)){ | |
| $is_nest = 0 < $level; | |
| $nest_level = $level - 1; | |
| } | |
| else{ | |
| $is_nest = true; |
| 'use strict' | |
| import _ from "lodash"; | |
| import SuperAgent from "superagent"; | |
| import Promise from "bluebird"; | |
| /** | |
| * Resource | |
| * | |
| * base of a resource class. |
| #!/bin/sh | |
| arch=`uname -m` | |
| if [ ! -d ${HOME}/app ]; then | |
| mkdir ~/app | |
| fi | |
| if [ ! -d ${HOME}/bin ]; then | |
| mkdir ~/bin | |
| fi |
| ;; (promise-> | |
| ;; (do-promise (console.log "first") (setTimeout (resolve "success") 3000)) | |
| ;; (then (console.log value)) | |
| ;; (catch (sonsole.log "error")) | |
| ;; ) | |
| (defmacro promise-> | |
| "promise chaining." | |
| [& operations] | |
| (reduce |
| !function(){ | |
| var d = document.getElementById("background-projects"), r = /^\s*他(\d+)/, | |
| othernum = function(lis) { | |
| return [].slice.apply(lis).map(function(vv) { | |
| return (rr = r.exec(vv.innerText.replace(/[A-Za-z0-9]/g, function(s) { | |
| return String.fromCharCode(s.charCodeAt(0) - 0xFEE0) | |
| }))) ? rr[1] - 1 : 0; | |
| }).reduce(function(a, b) { | |
| return a + b; | |
| }); |
| if not "function" == (typeof window.URL).toLowerCase() | |
| class window.URL | |
| constructor: (url)-> | |
| @href = url | |
| toString: ()-> | |
| @href | |
| parser = document.createElement("a") | |
| properties = [ |
| module.exports = window.WebSocket; |