Skip to content

Instantly share code, notes, and snippets.

View fdstevex's full-sized avatar

stevex fdstevex

View GitHub Profile
@fdstevex
fdstevex / gist:52da0d7e5892fe2965eae105b8cf3883
Created May 31, 2016 13:05
Running buildkite-agent as a Windows service
1. Download the Windows Service Wrapper binary from this project: https://github.com/kohsuke/winsw
2. Copy to your Buildkite directory and rename to "buildkite-service.exe"
3. Create buildkite-service.xml:
<service>
<id>buildkite-service</id>
<name>buildkite-service</name>
<description>The BuildKite build agent.</description>
@fdstevex
fdstevex / slackbot.js
Last active November 29, 2018 21:01
JS code that connects to Slack as a bot and answers 'ping' with 'pong'.
const { RTMClient, WebClient } = require('@slack/client');
var CLIENT_EVENTS = require('@slack/client').CLIENT_EVENTS;
const token = 'xoxb-token-here';
async function runBot() {
const rtm = new RTMClient(token);
const web = new WebClient(token);
@fdstevex
fdstevex / NSFetchedResultsController-UICollectionView-Example.m
Last active June 18, 2020 09:13
Changed implementation to use array of raw blocks instead of NSBlockOperation so it's easy to run them on the main thread.
// Properties:
@property (nonatomic) BOOL shouldReloadCollectionView;
@property (strong, nonatomic) NSMutableArray *collectionViewUpdateBlocks;
// NSFetchedResultsController Delegate Methods:
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
self.shouldReloadCollectionView = NO;
@fdstevex
fdstevex / LoginView.swift
Last active July 7, 2020 15:09
Login view based on @jordansinger's but with a placeholder for a function to do the login.
import SwiftUI
import PlaygroundSupport
struct SignUpView: View {
@State var username = ""
@State var password = ""
@State var loggedIn = false
var body: some View {
NavigationView {
#!/bin/swift
// Print all the characters in the "Supplementary Private Use Area-B" block.
import Cocoa
for ch:UInt32 in 0x100000..<0x10FFFF {
let arr = [ch]
let array: [UInt32] = [CFSwapInt32(ch)]
let data = array.withUnsafeBytes { (ptr) -> Data in
// How is it I can use SF Symbols images in text strings?
echo >bug.txt 􀌛
hexdump bug.txt
> f4 80 8c 9b
f4 = 11110100
80 = 10000000
8c = 10001100
9b = 10011011
struct Settings {
static var documentSelected = false
}
struct FolderPage: View {
@State var documentsLabel: String = Settings.documentSelected ? "Selected" : "Not selected"
var body: some View {
VStack {
VStack {