Skip to content

Instantly share code, notes, and snippets.

Avatar

Jacob Chapel chapel

View GitHub Profile
@chapel
chapel / About.md
Last active Oct 15, 2016
Discourse topic list customizations for http://discourse.wastingyourlife.co
View About.md
View actions.js
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
View actions.js
export const simpleAction = () => {
return {
type: 'SIMPLE_ACTION'
};
};
export const complexAction = (arg) => {
return {
type: 'COMPLEX_ACTION',
arg
@chapel
chapel / actions.js
Last active Feb 21, 2016
playing around with redux
View actions.js
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
View jsx.jsx
<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>
View gist:7921757
/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)
View blah.js
var fn = function* (args) {
yield asyncFn(args);
};
Object.defineProperty(this, 'fn', {
get: function () {
return function () {
return fn.next();
}
}
View base.js
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);}
View friends_glob.js
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);
View gist:6100340
[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