Skip to content

Instantly share code, notes, and snippets.

View matthewspear's full-sized avatar
🔨
Always Be Learning

Matt Spear matthewspear

🔨
Always Be Learning
View GitHub Profile
@georgevanburgh
georgevanburgh / stacks.s
Created November 27, 2015 16:29
Stack demonstration code from PASS1 workshop
; Move the stack pointer to point at the stack
ADRL SP, stack
; Define the strings we're going to print
s_div DEFB "Dividing ", 0
ALIGN
s_by DEFB " by ", 0
ALIGN
s_equals DEFB " equals ", 0
ALIGN
@natecook1000
natecook1000 / SimplePickerView.swift
Created January 6, 2015 21:48
Simple UIPickerView subclass
class SimplePickerView : UIPickerView {
class SimplePickerViewModel : NSObject, UIPickerViewDelegate, UIPickerViewDataSource {
var titles: [String]
var selectionHandler: ((pickerView: UIPickerView, row: Int, title: String) -> ())?
init(titles: [String], selectionHandler: ((pickerView: UIPickerView, row: Int, title: String) -> ())? = nil) {
self.titles = titles
self.selectionHandler = selectionHandler
}
@vicc
vicc / string-truncate.swift
Last active May 4, 2020 02:33 — forked from jesskturner/string-truncate.swift
A little truncate function extension for the default String type (Swift 3 Ready)
extension String {
/**
Truncates the string to the specified length number of characters and appends an optional trailing string if longer.
- Parameter length: A `String`.
- Parameter trailing: A `String` that will be appended after the truncation.
- Returns: A `String` object.
*/
func truncate(length: Int, trailing: String = "…") -> String {
@pmbauer
pmbauer / roam_wp
Last active July 22, 2020 02:15
roam weekly plan
#/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
roam_date() {
date -d "${*}" '+%B %eXX, %Y' \
| sed -e 's/11XX/11th/; s/12XX/12th/; s/13XX/13th/' \
-e 's/1XX/1st/; s/2XX/2nd/; s/3XX/3rd/' \
-e 's/XX/th/; s/ / /'
}
@MrTrustor
MrTrustor / clean-docker-for-mac.sh
Last active November 21, 2023 11:38
This script cleans the Docker.qcow2 file that takes a lot of disk space with Docker For Mac. You can specify some Docker images that you would like to keep.
#!/bin/bash
# Copyright 2017 Théo Chamley
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
@klange
klange / _.md
Last active December 2, 2023 20:36
It's a résumé, as a readable and compilable C source file. Since Hacker News got here, this has been updated to be most of my actual résumé. This isn't a serious document, just a concept to annoy people who talk about recruiting and the formats they accept résumés in. It's also relatively representative of my coding style.

Since this is on Hacker News and reddit...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is a good bit crazier.
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • Since people kept complaining, I've fixed the assignments of string literals to non-const char *s.
  • My use of type * name, however, is entirely intentional.
  • If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at le
@klaaspieter
klaaspieter / ASS.md
Created June 22, 2017 07:59 — forked from anonymous/ASS.md
Acronyms Seriously Suck - Elon Musk

From time to time, Musk will send out an e-mail to the entire company to enforce a new policy or let them know about something that's bothering him. One of the more famous e-mails arrived in May 2010 with the subject line: Acronyms Seriously Suck:

There is a creeping tendency to use made up acronyms at SpaceX. Excessive use of made up acronyms is a significant impediment to communication and keeping communication good as we grow is incredibly important. Individually, a few acronyms here and there may not seem so bad, but if a thousand people are making these up, over time the result will be a huge glossary that we have to issue to new employees. No one can actually remember all these acronyms and people don't want to seem dumb in a meeting, so they just sit there in ignorance. This is particularly tough on new employees.

That needs to stop immediately or I will take drastic action - I have given enough warning over the years. Unless an acronym is approved by me, it should not enter the SpaceX glossary.

@jimfoltz
jimfoltz / tw5-server.rb
Last active February 26, 2024 02:18
A local server for TiddlyWiki5 that allows saving wiki.
require 'webrick'
require 'fileutils'
if ARGV.length != 0
root = ARGV.first.gsub('\\', '/')
else
root = '.'
end
BACKUP_DIR = 'bak'
@ccabanero
ccabanero / Count lines of code in Xcode project
Created August 9, 2014 12:14
Count lines of code in Xcode project
1. Open Terminal
2. cd to your Xcode project
3. Execute the following when inside your target project:
find . -name "*.[hm]" -print0 | xargs -0 wc -l
@annalee
annalee / sample-slack-coc.md
Last active April 11, 2024 21:14
A sample code of conduct for social slack teams.

[SLACKNAME] Code of Conduct

Welcome!

[BRIEF DESCRIPTION OF THE SLACK AND ITS PURPOSE]

The current admins are:

  • [NAMES]