Skip to content

Instantly share code, notes, and snippets.

@chapel
chapel / About.md
Last active October 15, 2016 15:15
Discourse topic list customizations for http://discourse.wastingyourlife.co
import { combineReducers } from 'redux'
import { createAction, reduceActions } from './playground';
export const addTodo = createAction('ADD_TODO', combineReducers({
todos(state = [], text) {
return [
{
id: state.reduce((maxId, todo) => Math.max(todo.id, maxId), -1) + 1,
completed: false,
text
export const simpleAction = () => {
return {
type: 'SIMPLE_ACTION'
};
};
export const complexAction = (arg) => {
return {
type: 'COMPLEX_ACTION',
arg
@chapel
chapel / actions.js
Last active February 21, 2016 05:44
playing around with redux
import { createAction, createEffect, reduceActions } from './playground';
export const addTodo = createAction('ADD_TODO', (state, text) => {
return [
{
id: state.reduce((maxId, todo) => Math.max(todo.id, maxId), -1) + 1,
completed: false,
text
},
...state
@chapel
chapel / jsx.jsx
Last active January 2, 2016 15:19
<html data-reactid=".r[5sfzg]" data-react-checksum="1010059815"><head data-reactid=".r[5sfzg].[0]"></head><body data-reactid=".r[5sfzg].[1]"><div data-reactid=".r[5sfzg].[1].[0]">context</div><div data-reactid=".r[5sfzg].[1].[1]">baz</div></body></html>
/usr/local/lib/node_modules/cipherhub/node_modules/rsa-stream/node_modules/ursa/lib/ursa.js:291
return encodeBuffer(rsa.privateDecrypt(buf, padding), outEncoding);
^
Error: error:0407A079:rsa routines:RSA_padding_check_PKCS1_OAEP:oaep decoding error
at Object.decrypt (/usr/local/lib/node_modules/cipherhub/node_modules/rsa-stream/node_modules/ursa/lib/ursa.js:291:33)
at Through2._transform (/usr/local/lib/node_modules/cipherhub/node_modules/rsa-stream/index.js:37:27)
at Through2.Transform._read (_stream_transform.js:179:10)
at Through2.Transform._write (_stream_transform.js:167:12)
at doWrite (_stream_writable.js:221:10)
at writeOrBuffer (_stream_writable.js:211:5)
@chapel
chapel / blah.js
Last active December 22, 2015 18:49
var fn = function* (args) {
yield asyncFn(args);
};
Object.defineProperty(this, 'fn', {
get: function () {
return function () {
return fn.next();
}
}
@chapel
chapel / base.js
Last active December 21, 2015 05:58 — forked from anonymous/gist:6260605
exports.searchContactPost = function(req, res) {
if(req.body.searchContacts === '') { res.send('Oops you searching for nothing, well here is nothing!'); };
async.waterfall([
function(callback) {
User.find({$or:[
{firstName: req.body.searchContacts.toLowerCase()},
{lastName: req.body.searchContacts.toLowerCase()},
{email: req.body.searchContacts.toLowerCase()}]
}, function(err, users) {
if(err || users.length === 0) { res.send(err);}
var async = require('async');
function getUserFriends(userName, next) {
db.users.findOne({name:userName}, foundUser);
var glob = {};
function foundUser(err, user) {
if (err != null) return next(err);
[13:58:05 PM] <|oo|> Is this wiki page up-to-date? http://www.codeux.com/textual/wiki/Writing-Scripts.wiki ..claims custom script dir is ~/Library/Application Scripts/com.codeux.irc.textual but Textual prefs opens ~/Library/Containers/com.codeux.irc.textual/Data/Library/Application Scripts/com.codeux.irc.textual as custom addons dir
[13:58:33 PM] <|oo|> scripts in the former don't seem to be picked up by textual (and honestly I can't get them to work anywhere)
[13:59:52 PM] <|oo|> always says "Script Execution Failure: Script file is not in the application scripts folder." (using the example.scpt applescript from the wiki)
[14:02:18 PM] <chapel> |oo|: as long as they are in ~/Library/Application Scripts/com.codeux.irc.textual they seem to work for me
[14:03:14 PM] <chapel> and the latter location you listed is just a symlink