#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 { |
(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. |
{-# 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 |
;; 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 |
;; 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) |
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
CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.
In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.
First, let's illustrate the 3 styles by implementing
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
- There are always 24 hours in a day.
- February is always 28 days long.
- Any 24-hour period will always begin and end in the same day (or week, or month).
(defproject test-3d "0.1.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:url "http://example.com/FIXME" | |
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" | |
:url "https://www.eclipse.org/legal/epl-2.0/"} | |
:dependencies [[org.clojure/clojure "1.10.0"] | |
[org.lwjgl/lwjgl "3.2.2"] | |
[org.lwjgl/lwjgl "3.2.2" :classifier "natives-linux"] | |
[org.lwjgl/lwjgl-opengl "3.2.2"] | |
[org.lwjgl/lwjgl-opengl "3.2.2" :classifier "natives-linux"] |