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
alert(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
// Returns a function, that, when invoked, will only be triggered at most once | |
// during a given window of time. Normally, the throttled function will run | |
// as much as it can, without ever going more than once per `wait` duration; | |
// but if you'd like to disable the execution on the leading edge, pass | |
// `{leading: false}`. To disable execution on the trailing edge, ditto. | |
_.throttle = function(func, wait, options) { | |
var timeout, context, args, result; | |
var previous = 0; | |
if (!options) options = {}; |
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
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. | |
_.debounce = function(func, wait, immediate) { | |
var timeout, result; | |
var later = function(context, args) { | |
timeout = null; | |
if (args) result = func.apply(context, args); |
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
m.prototype.throttleSendRemoteQuery = function() { | |
'use strict'; | |
var n = c('FacebarGlobalOptions').sendRemoteQueryThrottleTime; | |
if (n === 0) { | |
this.sendRemoteQueryThrottled = this.sendRemoteQuery; | |
} else if (c('FacebarGlobalOptions').lazyThrottleRemoteQuery) { | |
var o = Date.now() | |
, p = c('FacebarGlobalOptions').enableSendRemoteQueryDelay | |
, q = c('FacebarGlobalOptions').sendRemoteQueryDelayTime; | |
this.sendRemoteQueryThrottled = function() { |
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
this.getRemoteSuggestions = function(a, b, c, d) { | |
if (!b || !this.needsRemoteRequest(b, d)) | |
return; | |
this.request[a] || (this.attr.useThrottle ? | |
this.request[a] = utils.throttle(this.splitRemoteRequests.bind(this), this.attr.remoteThrottleInterval) : | |
this.request[a] = utils.debounce(this.splitRemoteRequests.bind(this), this.attr.remoteDebounceInterval)), | |
b.query.indexOf("@") === 0 && b.typeaheadSrc === "COMPOSE" && (b.query = b.query.substring(1), | |
b.atSignRemoved = !0), | |
this.request[a](a, b, c, d) | |
} |
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
import React, { Component, PropTypes } from 'react' | |
import hljs from 'highlight.js/lib/highlight' | |
import javascript from 'highlight.js/lib/languages/javascript' | |
import php from 'highlight.js/lib/languages/php' | |
import python from 'highlight.js/lib/languages/python' | |
import sql from 'highlight.js/lib/languages/sql' | |
import objectivec from 'highlight.js/lib/languages/objectivec' | |
import 'highlight.js/styles/tomorrow.css' | |
const propTypes = { |
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
const renderMention = (entity) => { | |
const { link, name } = entity.data.mention | |
return `<a href="${link}">${name}</a>` | |
} | |
const renderEntity = (entity) => { | |
if (entity.type === 'mention') { | |
return renderMention(entity) | |
} |
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
import React, { Component, PropTypes } from 'react' | |
import { PDF_VIEWER } from '../configs' | |
const propTypes = { | |
ratio : PropTypes.number, | |
file : PropTypes.string.isRequired | |
} | |
const defaultProps = { | |
ratio: 56.25 |
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
# configs | |
JS_DIR=static/js/vendor/pdf.js | |
CSS_DIR=static/css/vendor/pdf.js | |
echo "[INFO] Clone https://github.com/mozilla/pdf.js into 'temp'" | |
git clone -b gh-pages https://github.com/mozilla/pdf.js temp | |
echo "[INFO] Init pdf.js directories" | |
rm -rf $JS_DIR | |
rm -rf $CSS_DIR |
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
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist' | |
alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist' | |
alias nginx.restart='nginx.stop && nginx.start' | |
alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php54.plist" | |
alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php54.plist" | |
alias php-fpm.restart='php-fpm.stop && php-fpm.start' | |
alias mysql.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist" | |
alias mysql.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist" | |
alias mysql.restart='mysql.stop && mysql.start' | |
alias nginx.logs.error='tail -250f /usr/local/etc/nginx/logs/error.log' |
NewerOlder