Skip to content

Instantly share code, notes, and snippets.

@manasthakur
manasthakur / plugins.md
Last active June 2, 2024 07:29
Managing plugins in Vim

Managing plugins in Vim: The basics

Let's say the plugin is at a GitHub URL https://github.com/manasthakur/foo. First get the plugin by either cloning it (git clone https://github.com/manasthakur.foo.git) or simply downloading it as a zip (from its GitHub page).

Adding a plugin in Vim is equivalent to adding the plugin's code properly into its runtimepath (includes the $HOME/.vim directory by default). For example, if the layout of a plugin foo is as follows:

foo/autoload/foo.vim
foo/plugin/foo.vim
@aamedina
aamedina / triangle.clj
Last active October 31, 2023 02:26
Drawing a Triangle with Vulkan in Clojure
;; Based on the 01_InitRaytracing.cpp example from VkRayTutorials
;; Copyright (c) 2018 Adrian Medina
(ns vk.ray.tutorials.init-raytracing
(:gen-class)
(:require
[vk.ray.tutorials.util :as util])
(:import
(java.nio ByteBuffer FloatBuffer IntBuffer LongBuffer)
(org.lwjgl PointerBuffer)
@martinklepsch
martinklepsch / logging.cljc
Last active October 22, 2018 18:27
simple Clojurescript logging using Google Closure logging tools
;; This previously was CLJX but has now been updated to use cljc. Thanks @caskolkm
;; https://gist.github.com/caskolkm/39d823f5bac7051d3062
(ns app.logging
(:refer-clojure :exclude [time])
(:require #?(:clj [clojure.tools.logging :as log]
:cljs [goog.log :as glog]))
#?(:cljs (:import goog.debug.Console)))
#?(:cljs
@mtolly
mtolly / Adder.hs
Created July 29, 2015 01:22
Small example of compiling a Haskell Mac .dylib to be used from C
{-# LANGUAGE ForeignFunctionInterface #-}
module Adder where
import Foreign.C
adder :: CInt -> CInt -> IO CInt
adder x y = return $ x + y
foreign export ccall adder :: CInt -> CInt -> IO CInt
@vvvvalvalval
vvvvalvalval / gist:c6c2d991bdc96cce4c14
Last active February 11, 2024 19:34
Asynchronous map function with clojure.core.async
(require '[clojure.core.async :as a])
(defn- seq-of-chan "Creates a lazy seq from a core.async channel." [c]
(lazy-seq
(let [fst (a/<!! c)]
(if (nil? fst) nil (cons fst (seq-of-chan c)) ))))
(defn map-pipeline-async "Map for asynchronous functions, backed by clojure.core.async/pipeline-async .
From an asynchronous function af, and a seq coll, creates a lazy seq that is the result of applying the asynchronous function af to each element of coll.
@aktau
aktau / nibless.m
Created January 14, 2014 23:00
nibless window creation in cocoa/objc
#import <AppKit/AppKit.h>
// clang -o nibless nibless.m -framework AppKit
@interface TestView : NSView <NSWindowDelegate> { }
-(void)drawRect:(NSRect)rect;
@end
@implementation TestView
-(void)drawRect:(NSRect)rect {