Skip to content

Instantly share code, notes, and snippets.

@dsosby
dsosby / gist:3744784
Created September 18, 2012 18:15
ClojureScript Goodies
;Get all methods/properties of some object
(goog.object/getKeys some-object)
;Getting undefined errors? Use undefined? to probe
(undefined? load-namespace)
(undefined? str)
@dsosby
dsosby / gist:3756552
Created September 20, 2012 15:19
make-param-str
(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
dsosby / PairSwap.c
Last active December 16, 2015 13:09
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
typedef struct Node {
int data;
struct Node *next;
struct Node *prev;
} Node;
@dsosby
dsosby / notgoodbye.ts
Created March 11, 2019 22:42
TypeScriptConditionalType
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');
// Name: pull requests
import "@johnlindquist/kit";
const ghToken = await env('GH_TOKEN', 'Add your Github Personal Access Token');
const repo = 'johnlindquist/kit';
const [owner, name] = repo.split('/', 2);
const query = `
query pullRequests($owner: String!, $name: String!) {