Skip to content

Instantly share code, notes, and snippets.

@thedillonb
thedillonb / Food
Created July 2, 2017 01:37
Creat!!
Goes in my tummy
@thedillonb
thedillonb / stamp.cs
Created April 1, 2016 01:01
Stamp iOS With Date
public static class UIApplicationDelegateExtensions
{
/// <summary>
/// Record the date this application was installed (or the date that we started recording installation date).
/// </summary>
public static DateTime StampInstallDate(this UIApplicationDelegate @this, string name)
{
try
{
var query = new SecRecord(SecKind.GenericPassword) { Service = name, Account = "account" };
@thedillonb
thedillonb / index.js
Last active April 23, 2017 00:59
NodeJS Graceful shutdown of a HTTP server
'use strict';
const http = require('http');
function addGracefulShutdown(server) {
const oldClose = server.close;
const connections = {};
let shouldDestroy = false;
let connectionId = 0;
function destroy(socket) {
@jinxidoru
jinxidoru / closeable_http_server.ts
Last active January 24, 2022 19:31
Closeable http server
import * as http from 'http'
import * as _ from 'lodash'
//! In the standard implementation of http server, calling close is not guaranteed to close the
//! server. Any idle connections being kept alive by clients will stay open until their timeout
//! is reached. This is problematic for gracefully shutting down a process with an http server.
//! This function will create an http server that tracks the open connections. On close, idle
//! connections are closed and any newly idled connection is immediately closed as well. When there
//! are no more connections on the server, the 'empty' event is raised.
coooooo
/************************
* validationEngaged.js *
************************
*
* They're really on to us now! The validateLevel function
* has been activated to enforce constraints on what you can
* do. In this case, you're not allowed to remove any blocks.
*
* They're doing all they can to keep you here. But you
* can still outsmart them.

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

@clarkdave
clarkdave / logstash-sentry.rb
Last active May 15, 2023 11:34
(Logstash) Sentry output plugin
# The MIT License (MIT)
# Copyright (c) 2014 Dave Clark
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@thedillonb
thedillonb / extract.rb
Created February 1, 2014 17:07
Extracts glyphs from a TTF format into multiple PNG files using ImageMagick. Boo
# Usage: ruby extract.rb <TTF> <size: WxH> <output dir>
require 'ttfunk'
file = TTFunk::File.open(ARGV[0])
size = ARGV[1]
output_dir = ARGV[2]
`mkdir #{output_dir}`
cmap = file.cmap
chars = {}
Hey huys??!