Skip to content

Instantly share code, notes, and snippets.

View main.cc
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/un.h>
int main (int argc, char const* argv[])
{
int fd = socket(AF_UNIX, SOCK_STREAM, 0);
if(fd != -1)
{
char const* socket_path = "/tmp/test.socket";
@sorbits
sorbits / macos.css
Created May 27, 2020
CSS variables (and minimal setup) for TextMate web output
View macos.css
:root {
--textColor: rgba(0, 0, 0, 1.00);
--textBackgroundColor: rgba(255, 255, 255, 1.00);
--selectedTextColor: rgba(0, 0, 0, 1.00);
--selectedTextBackgroundColor: rgba(179, 215, 255, 1.00);
--linkColor: rgba(0, 104, 218, 1.00);
--headerTextColor: rgba(0, 0, 0, 0.85);
--labelColor: rgba(0, 0, 0, 0.85);
View gist:64da7bbfb46486d8da66d8f502b4ca30
textColor
linkColor
textBackgroundColor
labelColor
secondaryLabelColor
tertiaryLabelColor
quaternaryLabelColor
systemBlueColor
View gist:29acca5019b194eb65159ccc6cafc5b5
### Keybase proof
I hereby claim:
* I am sorbits on github.
* I am sorbits (https://keybase.io/sorbits) on keybase.
* I have a public key ASCRO9t0xfm4YjzZaIbm6yx5y2_lWRfwfKKiIsVCnDEKoAo
To claim this, I am signing this object:
@sorbits
sorbits / volumes.cc
Created Apr 24, 2018
Get list of browsable volumes
View volumes.cc
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/ucred.h>
#include <string.h>
#include <vector>
#include <string>
std::vector<std::string> volumes ()
{
std::vector<std::string> res;
View untitled.cc
#import <CoreServices/CoreServices.h>
int main (int argc, char const* argv[])
{
CFShow(LSCopyApplicationURLsForBundleIdentifier(CFSTR("com.macromates.TextMate"), nullptr));
return 0;
}
@sorbits
sorbits / CSS Colors in Gutter.rb
Created Feb 15, 2017
Create new command and set scope selector to `source.css` and semantic class to `callback.document.did-open, callback.document.did-save`
View CSS Colors in Gutter.rb
#!/usr/bin/env ruby -wU
require 'erb'
require 'fileutils'
require 'shellwords'
# extension to String to extract colours into rgb array
class String
# hex to array
def h2a
if self.length == 4
View fontStyle.cc
std::string fontStyle;
if(plist::get_key_path(plist, "settings.fontStyle", fontStyle))
{
bool hasPlain = fontStyle.find("plain") != std::string::npos;
bool hasBold = fontStyle.find("bold") != std::string::npos;
bool hasItalic = fontStyle.find("italic") != std::string::npos;
bool hasUnderline = fontStyle.find("underline") != std::string::npos;
res.bold = hasBold ? bool_true : (hasPlain ? bool_false : bool_unset);
res.italic = hasItalic ? bool_true : (hasPlain ? bool_false : bool_unset);
@sorbits
sorbits / Color Marks.tmCommand
Last active Jun 6, 2016 — forked from gdsmith/Color Marks.tmCommand
Textmate command to find, create and add color marks for hex and rgb colors
View Color Marks.tmCommand
#!/usr/bin/env ruby -wU
require 'erb'
require 'fileutils'
require 'shellwords'
# extension to String to extract colours into rgb array
class String
# hex to array
def h2a
@sorbits
sorbits / test.mm
Created Jan 16, 2016
This is the file read by clang.mm (previous gist)
View test.mm
#if (__cplusplus && __cplusplus >= 201103L && (__has_extension(cxx_strong_enums) || __has_feature(objc_fixed_enum))) || (!__cplusplus && __has_feature(objc_fixed_enum))
#warning "we are OK"
#endif
#import <CoreFoundation/CoreFoundation.h>
#import <MacTypes.h>
#import <stdio.h>
#import <stdint.h>
#import <math.h>
#import <pthread.h>