Skip to content

Instantly share code, notes, and snippets.

View goranmoomin's full-sized avatar

Sungbin Jo (조성빈) goranmoomin

View GitHub Profile
@goranmoomin
goranmoomin / NSPopoverDelegate.swift
Created August 27, 2020 00:21
Making a window controller with a popover appearance (which didn't go into code, but might be useful in the future)
func detachableWindow(for popover: NSPopover) -> NSWindow? {
let windowController = NSStoryboard.main?.instantiateController(withIdentifier: .replyWindowController) as! NSWindowController
let replyPopupViewController = windowController.contentViewController as! ReplyPopoverViewController
replyPopupViewController.comment = comment
let window = windowController.window!
window.setContentSize(popover.contentSize)
window.isMovableByWindowBackground = true
let visualEffectView = window.contentView as! NSVisualEffectView
visualEffectView.state = .active
visualEffectView.material = .popover
@goranmoomin
goranmoomin / remove-fileheader.sh
Last active July 7, 2020 09:28
Xcode remove `//__FILEHEADER__`
#!/bin/bash
grep -l FILEHEADER -R /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates | grep -v plist | while IFS= read -r file
do
sudo sed -i '' '/\/\/___FILEHEADER___/d' "$file"
done
@goranmoomin
goranmoomin / emacs-xwidget.patch
Created March 25, 2020 13:51
emacs-xwidget.patch
diff --git a/configure.ac b/configure.ac
index f604acb694..2d92d4b6ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -484,7 +484,7 @@ AC_DEFUN
[with_file_notification=$with_features])
OPTION_DEFAULT_OFF([xwidgets],
- [enable use of some gtk widgets in Emacs buffers (requires gtk3)])
+ [enable use of xwidgets in Emacs buffers (requires gtk3 or macOS Cocoa)])
@goranmoomin
goranmoomin / issue-log-83.md
Last active December 3, 2020 11:34
actix-service Cell::get_mut() is unsound
@goranmoomin
goranmoomin / english-survey.conf
Last active December 26, 2019 10:25
English Survey Project NGINX configuration
server {
listen 8001;
server_name english-survey;
charset utf-8;
root $PWD;
location ~ ^/(auth|master|survey) {
proxy_redirect off;
@goranmoomin
goranmoomin / all-posts.sh
Last active December 26, 2020 12:36
Shell one liners to get various HN account information
#!/bin/sh
curl -s https://hacker-news.firebaseio.com/v0/user/pcr910303.json | jq '.submitted | .[]' | xargs -P30 -I{} sh -c 'curl --silent https://hacker-news.firebaseio.com/v0/item/{}.json | jq --raw-output '\''select(.type == "story" and .deleted != true) | .title'\'
@goranmoomin
goranmoomin / regex.c
Created November 30, 2019 16:42
Check if regex is a valid POSIX Extended regex
#include <stdio.h>
#include <regex.h>
int main(void) {
char pattern[256];
scanf("%s", pattern);
regex_t regex;
const int errcode = regcomp(&regex, (const char *)pattern, REG_EXTENDED);
if(errcode == 0) {
printf("regex valid\n");
@goranmoomin
goranmoomin / enforester.js
Created November 22, 2019 01:08
enforestForStatement
enforestForStatement() {
this.matchKeyword("for");
const condition = this.matchParens();
const conditionEnforester = new Enforester(condition);
if(conditionEnforester.isPunctuator(conditionEnforester.peek(), ";")) {
conditionEnforester.advance();
const test = conditionEnforester.isPunctuator(conditionEnforester.peek(), ";") ? null : conditionEnforester.enforestExpression();
conditionEnforester.matchPunctuator(";");
const update = conditionEnforester.terms.length === 0 ? null : conditionEnforester.enforestExpression();
const body = this.enforestStatement();
From 6d95860c506233502b8b9d59609e653085412092 Mon Sep 17 00:00:00 2001
From: Sungbin Jo <pcr910303@icloud.com>
Date: Thu, 25 Jul 2019 23:55:42 +0900
Subject: [PATCH 1/3] Add xwidget webkit support for macOS
Co-authored-by: Jaesup Kwak <veshboo@gmail.com>
* configure.ac: Allow '--with-xwidgets' for "${NS_IMPL_COCOA}".
* etc/NEWS: Mention new feature.
* etc/TODO: Remove done TODO to implement xwidget in NeXTstep port.
@goranmoomin
goranmoomin / 1_all_webkit.patch
Last active May 16, 2019 13:14
One-stop patch for Emacs NS-port xwidget (by @veshboo)
diff --git a/configure.ac b/configure.ac
index d13dddfd9a..525c4c6703 100644
--- a/configure.ac
+++ b/configure.ac
@@ -483,7 +483,7 @@ AC_DEFUN
[with_file_notification=$with_features])
OPTION_DEFAULT_OFF([xwidgets],
- [enable use of some gtk widgets in Emacs buffers (requires gtk3)])
+ [enable use of some gtk widgets in Emacs buffers (requires gtk3 or macOS Cocoa)])