Skip to content

Instantly share code, notes, and snippets.

View timhudson's full-sized avatar

Tim Hudson timhudson

View GitHub Profile
@timhudson
timhudson / custom_instructions.md
Last active September 25, 2023 20:18
Collection of prompts

Precision Engineering Mode

- Be highly organized
- Suggest solutions that I didn’t think about—be proactive and anticipate my needs
- Treat me as an expert in all subject matter
- Mistakes erode my trust, so be accurate and thorough
- Provide detailed explanations, I’m comfortable with lots of detail
- Value good arguments over authorities, the source is irrelevant
- Consider new technologies and contrarian ideas, not just the conventional wisdom
@timhudson
timhudson / RootQuery.js
Created May 1, 2017 19:51
Colocating GraphQL resolvers with types
export default `
type RootQuery {
user(id = String, email = String) User
}
`
export const user = async (_, { id, email }, ctx) => {
return {
id: 'this',
name: 'that'
@timhudson
timhudson / analytics-ql.js
Last active March 14, 2017 20:57
Analytics.ql
const query = `
query ($workspaceSlug: String, $sourceSlug: String) {
segment {
workspace(slug: $workspaceSlug) {
id
}
source(slug: $sourceSlug) {
id
}
}
@timhudson
timhudson / index.js
Created February 25, 2016 20:33
Budo with iframe
console.log('oh snap!')
var redux = require('redux')
console.log('we made it!')
@timhudson
timhudson / index.js
Created June 11, 2015 00:38
requirebin sketch
var haikuStudio = require('haiku-studio');
var haiku = haikuStudio.generate();
alert(haiku)
@timhudson
timhudson / While.java
Last active August 29, 2015 14:21
Super unscientific benchmark of while loops in Java and JavaScript
public class While {
private static final long iterations = 1000000000;
private static long count = 0;
public static void main(String[] args) {
long start = System.currentTimeMillis();
while (count < iterations * 10) {
count++;
}
@timhudson
timhudson / index.js
Last active August 29, 2015 14:21
gzip dropped file
var dragDrop = require('drag-drop')
var createReadStream = require('filereader-stream')
var zlib = require('zlib')
dragDrop('#dropTarget', function (files, pos) {
createReadStream(files[0])
.pipe(zlib.createGzip())
.on('data', function (data) {
console.log(data)
})
@timhudson
timhudson / json-object-write-stream.js
Last active August 29, 2015 14:20
json-object-write-stream
var jsonStream = jsonObjectWriteStream()
fs.createReadStream(‘path/to/description’)
.pipe(jsonStream.createAttributeWriteStream(’description’))
jsonStream.pipe(process.stdout)
// {“description”: “whatever was inside the path/to/description file”}
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Eighties.tmTheme",
"create_window_at_startup": false,
"font_face": "Droid Sans Mono",
"font_size": 19.0,
"highlight_line": true,
"remember_full_screen": true,
"scroll_past_end": true,