Skip to content

Instantly share code, notes, and snippets.

View bayleedev's full-sized avatar
🍿

Baylee Schmeisser bayleedev

🍿
View GitHub Profile
function testApiRecursive (data) {
console.log('calling it', data)
return Promise.resolve().then(() => {
if (Math.round(Math.random() * 10000) % 20 === 0) {
// true 1/20th of the time
return data
} else {
return new Promise((resolve) => {
setTimeout(resolve, 250) // wait 250ms to run again
}).then(testApiRecursive.bind(this, data))
> JSON.parse(fs.readFileSync('./results.dat'))
[ { title: 'FeatureFlag',
subtitle: 'https://featureflag.nr-ops.net/' },
{ title: 'FeatureFlag',
subtitle: 'https://staging-featureflag.newrelic.com/' },
{ title: 'Filterable Errors' },
{ title: 'Google Analytics' },
{ title: 'Thread Profile' },
{ title: 'Floorplan for 28' },
{ title: 'Floorplan for 29' },
#![allow(warnings)]
// Goal #1: Eliminate the borrow check error in the `remove` method.
// parallelization is anti-encapsulation
pub struct Map<K: Eq, V> {
elements: Vec<(K, V)>,
}
impl<K: Eq, V> Map<K, V> {
struct Foo<'a> {
x: &'a i32,
}
impl<'a> Foo<'a> {
fn x(&self) -> &'a i32 { self.x }
}
fn blah() -> i32 {
let y = &5; // this is the same as `let _y = 5; let y = &_y;`
@bayleedev
bayleedev / downvote
Created August 22, 2016 18:36
pandora applescript
on alfred_script(q)
set old to (path to frontmost application as text)
tell application "Pandora"
reopen
activate
end tell
tell application "System Events"
keystroke "-"
end tell
activate application old
const Holidays = require('date-holidays')
const hd = new Holidays('US')
const process_name = (name) => {
return name.toLowerCase()
.replace(/ /g, '-')
.replace(/[^a-z-]+/g, '')
}
const holidays = hd.getHolidays(2016).map((item) => {

Problem

We can release a new versin of Zazu with backwards incompatiable changes to themes OR/and plugins. A user has no built-in interface for updating dependencies.

Proposed Solution

Zazu can maintain a list of breaking changes by type:

themes: ['0.1.0 - 0.1.5', '1.0.0 - 0.2.0'],
plugins/tinytacoteam/zazu-file-finder master ✔ jruby-9.0.0.0 1d
▶ git remote -v
origin https://github.com/tinytacoteam/zazu-file-finder.git (fetch)
origin https://github.com/tinytacoteam/zazu-file-finder.git (push)
plugins/tinytacoteam/zazu-file-finder master ✔ jruby-9.0.0.0 1d
▶ git ssh
plugins/tinytacoteam/zazu-file-finder master ✔ jruby-9.0.0.0 1d
▶ git remote -v
var debounce = (fn, time) => {
const context = this
let timeout = 0
return function (chr) {
return fn.apply(context, arguments)
}
}
var fn = (args) => {
console.log('meow', args)
var Joi = require('joi');
var schema = Joi.object().keys({
id: Joi.any(),
type: Joi.string(),
respondsTo: Joi.func().required(),
script: Joi.string().required(),
connections: Joi.array().required(),
})