Skip to content

Instantly share code, notes, and snippets.

View Lejdborg's full-sized avatar

Christoffer Lejdborg Lejdborg

View GitHub Profile
@rpearce
rpearce / lightenDarkenHex.js
Created March 31, 2021 14:17
Ligthen Darken Hex Colors
// helper functions are from https://github.com/rpearce/hex
const lightenDarken = (direction, color) => {
const rgb = hexToRgba(color).slice(0, 3)
// algo from https://stackoverflow.com/a/21038522/680394
const rgbAdjusted = direction >= 0
? rgb.map(x => (1 - direction) * x + direction * 255)
: rgb.map(x => (1 + direction) * x)
@jwilling
jwilling / gist:4186817
Last active March 5, 2023 22:01
Lets help improve AppKit.

Is AppKit causing you frustration? Instead of just complaining about it, lets try to make it better by compiling a list of specific problems with AppKit. Leave a comment below, and I'll include it in the list.


##NSView##

  • NSView does not have the ability to set an affine transform (rdar://15608609)
  • Controls that have cells (such as NSTextField) do not respond properly when layer-backed. Take NSButton as an example. When not layer-backed, it will animate properly using the animator proxy. When layer-backed, using the animator proxy breaks focus rings (they jump to destination immediately). Currently, directly manipulating the layer of a cell-based control is not supported (and will lead to a broken interface), but is much needed. (rdar://15608822)

##NSViewController##

  • NSViewController could be more useful. It has -loadView but no other lifecycle methods. (rdar://15608948)
@dtjm
dtjm / haml_converter.rb
Created August 10, 2010 16:34
HAML plugin for jekyll
# _plugins/haml_converter.rb
module Jekyll
class HamlConverter < Converter
safe true
def setup
return if @setup
require 'haml'
@setup = true