Skip to content

Instantly share code, notes, and snippets.

View ArthurYidi's full-sized avatar

Arthur Yidi ArthurYidi

  • San Francisco, California
View GitHub Profile

Fixing macOS 10.14, 10.15, 12

Dark main menu without the rest of dark mode

  1. Set Light mode
  2. defaults write -g NSRequiresAquaSystemAppearance -bool Yes
  3. Log out and log back in
  4. Set Dark mode
@phuochau
phuochau / callback_objc2cocoa.md
Last active April 11, 2018 23:40
Using callback from Objective-C to Cocoascript

Re-build cocoa framework

  • Clone source code from: https://github.com/ccgus/CocoaScript
  • Make MOJavascriptObject.h as public headers in Build Phases
  • Build project and we will get CocoaScript.framework
  • Copy CocoaScript.framework to your Xcode project

Define the objective-c methods with callback

API.h

@franjohn21
franjohn21 / generate-inverse-unicode-range.js
Created September 19, 2017 05:20
Inverse of critical unicode-range
const CharacterSet = require('characterset')
const critical = CharacterSet.parseUnicodeRange('U+00-A0,U+A9,U+AE,U+B2-B3,U+B9,U+2013-2014');
const all = CharacterSet.parseUnicodeRange('U+0000-FFFF');
const inverseOfCritical = all.difference(critical)
console.log(inverseOfCritical.toHexRangeString())
// => U+A1-A8,U+AA-AD,U+AF-B1,U+B4-B8,U+BA-2012,U+2015-FFFF
// gif by dave aka @beesandbombs :)
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
@darconeous
darconeous / os-x-syslog-server.md
Last active September 3, 2024 21:38
Using OS X as a Syslog Server

Using OS X as a Syslog Server

This document describes how to set up an OS X to be a syslog server that logs messages from the local network. It was largely meant for my own purposes so that I don't forget what I did, but feel free to use it for your own purposes.

A problem with just "turning this on" is that you will not see the correct hostname in the syslog entries. What we will do is use

@bomberstudios
bomberstudios / README.md
Last active February 16, 2022 03:13
Loading a Cocoa Framework in a Sketch Plugin

This is what Craft does:

function loadFramework(pluginRoot) {
  if (NSClassFromString('PanelsManager') == null) {
    var mocha = [Mocha sharedRuntime];
    return [mocha loadFrameworkWithName:'Panels' inDirectory:pluginRoot];
  } else {
    return true;
 }
@sharplet
sharplet / trap.swift
Created November 23, 2015 03:46
Simple signal handling in Swift
import Darwin
enum Signal: Int32 {
case HUP = 1
case INT = 2
case QUIT = 3
case ABRT = 6
case KILL = 9
case ALRM = 14
case TERM = 15
@alanzeino
alanzeino / lldb-debugging.md
Last active May 29, 2024 03:18
LLDB debugging with examples

LLDB Debugging Cheat Sheet

Commands

LLDB Commands

LLDB comes with a great set of commands for powerful debugging.

help

Your starting point for anything. Type help to get a list of all commands, plus any user installed ones. Type 'help for more information on a command. Type help to get help for a specific option in a command too.

@paulirish
paulirish / what-forces-layout.md
Last active November 23, 2024 09:57
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@shaunlebron
shaunlebron / es7coreasync.md
Last active July 28, 2018 07:58
es7 vs core.async

Comparing ES7 and core.async

ES7 core.async
async function() {...} (fn [] (go ...))
await ... (<! ...)
await* or Promise.all(...) (doseq [c ...] (<! c))