Skip to content

Instantly share code, notes, and snippets.

View vanwagonet's full-sized avatar

Andy VanWagoner vanwagonet

View GitHub Profile
@vanwagonet
vanwagonet / FlowStack.swift
Created March 4, 2022 20:33
Simple flow layout in SwiftUI
import SwiftUI
/// A view that arranges its children in horizontal lines
///
/// FlowStack {
/// ForEach(1..<100) { num in
/// Text(String(num))
/// .padding(8)
/// .background(Circle().fill(Color.red))
/// }
@vanwagonet
vanwagonet / syntastic_javascript_local_exec.vim
Created October 5, 2017 03:04
Use the locally installed node modules for eslint and flow checking
" return full path with the trailing slash or empty string
fun! s:GetNodeModulesAbsPath ()
let lcd_saved = fnameescape(getcwd())
silent! exec "lcd" expand('%:p:h')
let path = finddir('node_modules', '.;')
exec "lcd" lcd_saved
" fnamemodify will return full path with trailing slash;
" if no node_modules found, we're safe
return path is '' ? '' : fnamemodify(path, ':p')
@vanwagonet
vanwagonet / gist:d707683604a3e4ad042a
Last active August 29, 2015 14:10
Keep controller logic out of view components using react-router
...
<Route handler={ require('./main-page') } dataStore={ require('./main-page-data-factory') }>
...
Router.run(routes, function(err, Handler, state) {
let sdata = state.dataStore.getServer(); // Hander.dataStore.getServer()
sdata.get().then(funciton(data) {
React.renderToString(<Handler data={ data }>);
});
});