View zshrc.sh
# $1 = type; 0 - both, 1 - tab, 2 - title
# rest = text
setTerminalText () {
# echo works in bash & zsh
local mode=$1 ; shift
echo -ne "\033]$mode;$@\007"
}
set_tab_name () { setTerminalText 1 $@; }
stt_title_name () { setTerminalText 2 $@; }
View template.html
<!-- Expose keys of the `accordion` object to the scope -->
{#accordion}
<div class="accordion-wrapper">
<!-- Output a component called `accordion` and pass it `items` + `class` -->
{@c-accordion items=items class="padding-top-small"}
<!-- Override the `footer` block -->
{:footer}
<!-- Iterate the `links` array and expose keys of each object -->
{#links}
<!-- Output a component called `link` and pass it a `class` -->
View api.js
module.exports = function(app) {
function sendResponse(res, callback, code, message, data) {
var data = {code: code, message: message, data: data};
var content;
if (callback) {
content = callback + '(' + JSON.stringify(data) + ')';
res.writeHead(200, {
'Content-Length': lengthInUtf8Bytes(content),
View react.js
// client/app/router.jsx
// Setup routes
// For different templates based on domain
var SiteRoutes = {
'test1.com': (
<Route handler={ReactRouter.RouteHandler}>
<Route path='/' handler={require('./routes/test1.com/home.jsx')} />
<Route path='/sets' handler={require('./routes/test1.com/sets.jsx')} />
<Route path='/sets/:action' handler={require('./routes/test1.com/sets.jsx')} />
View pushState
var dummyLink = document.createElement('a');
var absolutify = function (url) {
dummyLink.href = url;
return dummyLink;
};
$('body').on('click', 'a', function(e) {
var $anchor = $(this);
View Navbar.js
var Navbar = React.createClass({
getInitialState() {
return {
view: 'fullscreen',
top: 100,
left: 0
};
}
View NavItem.js
var Navbar = React.createClass({
getInitialState() {
return {
view: 'fullscreen',
top: 100,
left: 0
};
}
View gist:fc647b3ad50f6824a56e
dust.helpers["tap"] = function(input, chunk, context) {
// return given input if there is no dust reference to resolve
// dust compiles a string/reference such as {foo} to a function
if (typeof input !== "function") {
return input;
}
var dustBodyOutput = '',
View script.js
// ==UserScript==
// @name Japanese Text-To-Speech
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match http://www.memrise.com/course/*/*/edit/
// @copyright 2012+, You
// ==/UserScript==
unsafeWindow.injectTTS = function(ttsURL) {
View server.js
var connect = require('connect');
var http = require('http');
var exec = require('child_process').exec;
var url = require('url');
var app = connect()
.use(function(req, res) {
var queryData = url.parse(req.url, true).query;
var callback = queryData.callback;