Skip to content

Instantly share code, notes, and snippets.

David Sosby dsosby

Block or report user

Report or block dsosby

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dsosby / notgoodbye.ts
Created Mar 11, 2019
View notgoodbye.ts
type NotGoodbye<T> = T extends "goodbye" ? never : T;
type Salutation = "hello" | "goodbye";
type AllPossibleWords = string
type AllPossibleWordsWithoutGoodbye = NotGoodbye<AllPossibleWords>
function neverSayBye(salutation: NotGoodbye<Salutation>, greetee: string) {
console.log(`${salutation} ${greetee}`)
neverSayBye('goodbye', 'David');
View PairSwap.c
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
typedef struct Node {
int data;
struct Node *next;
struct Node *prev;
} Node;
View gist:3756552
(defn make-param-str [param-map]
(join "&" (map (fn [[key val]] (format "%s=%s" (name key) val)) param-map)))
;TODO still needs URL encoding -- format wont work in clojurescript
dsosby / gist:3744784
Created Sep 18, 2012
ClojureScript Goodies
View gist:3744784
;Get all methods/properties of some object
(goog.object/getKeys some-object)
;Getting undefined errors? Use undefined? to probe
(undefined? load-namespace)
(undefined? str)
View gist:3123580
boolean isFoo() {
int status = this.getStatus();
return (status != STATUS_BAR &&
status != STATUS_BAZ);
boolean isFoo() {
dsosby / .taskrc
Created Jun 19, 2012
My TaskWarrior RC file
View .taskrc
# [Created by task 2.0.0 6/5/2012 10:23:30]
# Taskwarrior program configuration file.
# For more documentation, see or try 'man task', 'man task-faq',
# 'man task-tutorial', 'man task-color', 'man task-sync' or 'man taskrc'
# Here is an example of entries that use the default, override and blank values
# variable=foo -- By specifying a value, this overrides the default
# variable= -- By specifying no value, this means no default
# #variable=foo -- By commenting out the line, or deleting it, this uses the default
dsosby / gist:2255328
Created Mar 30, 2012
vimrc for work pc (win)
View gist:2255328
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
"behave mswin
if has('gui_running')
set guioptions-=T " no toolbar
colorscheme obsidian2
View gist:2160486
var loglevel = 3;
function debug(message, level) {
level = level || 1;
if ( console ) {
if ( level >= loglevel ) {
dsosby / gist:1823881
Created Feb 14, 2012
Jsonp & Clojurescript
View gist:1823881
(def tumblr-url "")
(defn display-count [json-obj]
(let [data (js->clj json-obj :keywordize-keys true)
post-count (:count data)]
(js/alert (str "Number of posts: " post-count))))
(defn display-items [json-obj]
(let [data (js->clj json-obj :keywordize-keys true)
items (:items (:value data))
View gist:1754623
public class Foo {
boolean a;
int b;
public Foo() {
a = true;
b = 42;
You can’t perform that action at this time.