Skip to content

Instantly share code, notes, and snippets.

View aaronjensen's full-sized avatar

Aaron Jensen aaronjensen

View GitHub Profile
ready "codepoints" do
before do
@str = "a" * 30 + "x"
end
go "index many matches" do
index = @str.index("a")
while index
index = @str.index("a", index + 1)
end
gulp = require('gulp')
browserSync = require('browser-sync')
gulp.task 'browser-sync', ['webpack:dev-server'], ->
browserSync(
proxy: "localhost:8081"
port: 8080
)
class Foo < SimpleDelegator
def in(&block)
instance_eval &block
end
def have_awesomeness
matcher do |target|
expect(target).to eq 3
end
end
require 'socket'
require 'benchmark'
puts Benchmark.measure { Socket::gethostbyname(Socket::gethostname) }
# 0.000000 0.000000 0.000000 ( 5.004441)
# fix, in /etc/hosts: 127.0.0.1 localhost my-host.local
# OR: enable IPv6
FUNCTION neocomplete#handler#_on_write_post()
Called 1 time
Total time: 0.000068
Self time: 0.000068
count total (s) self (s)
" Restore foldinfo.
1 0.000040 for winnr in filter(range(1, winnr('$')), "!empty(getwinvar(v:val, 'neocomplete_foldinfo'))")
let neocomplete_foldinfo = getwinvar(winnr, 'neocomplete_foldinfo')
call setwinvar(winnr, '&foldmethod', neocomplete_foldinfo.foldmethod)
EditorState = require './editor-state'
describe "", ->
[editor, editorView] = []
beforeEach ->
waitsForPromise -> atom.workspace.open()
runs ->
editor = atom.workspace.getActiveTextEditor()
editorView = atom.views.getView(editor)
#!/usr/bin/env ruby
PATH = File.expand_path('../..', __FILE__)
PACKAGES_TXT = File.join(PATH, "packages.txt")
def package_list
"apm list --installed --bare --dev false"
end
def main
function doMoneyMaking(dispatch) {
return apiCall()
.then(() => {
dispatch({ type: MAKE_MONEY_SUCCESS });
})
}
const actions = {
makeMoney() {
return doMoneyMaking;
@aaronjensen
aaronjensen / connect.jsx
Last active July 28, 2017 18:43
Redux shim for converting from Fluxxor
const React = require('react');
const mapValues = require('lodash/object/mapValues');
const createGetState = require('app/redux_shims/create_get_state');
const Fluxxor = require('fluxxor');
const FluxMixin = Fluxxor.FluxMixin(React);
const StoreWatchMixin = Fluxxor.StoreWatchMixin;
const createDispatcher = require('app/redux_shims/create_dispatcher');
const Router = require('react-router');
function bindActionCreator(flux, router, action) {
const { createStore, combineReducers, applyMiddleware, compose } = require('redux');
const reducers = require('app/reducers');
const thunkMiddleware = require('redux-thunk');
const simpleDispatchThunkMiddleware = require('app/redux/simple_dispatch_thunk_middleware');
const { batchedUpdates } = require('redux-batched-updates');
const simpleDispatch = require('app/redux/simple_dispatch');
const finalCreateStore = compose(
applyMiddleware(thunkMiddleware),
simpleDispatch,