Skip to content

Instantly share code, notes, and snippets.

// The SwiftUI Lab
// Website: https://swiftui-lab.com
// Article: https://swiftui-lab.com/alignment-guides
import SwiftUI
struct ContentView: View {
@State var position: Int = 0
var body: some View {
@unnamedd
unnamedd / MacEditorTextView.swift
Last active May 26, 2024 17:49
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://twitter.com/tholanda
*
* MIT license
*/
import Combine
import SwiftUI
@KasiL
KasiL / Contract Killer 3.md
Created December 5, 2017 18:57 — forked from tony-caffe/Contract Killer 3.md
The latest version of Bytes Unlimted ‘killer contract’ for web professionals

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Revised by Bytes Unlimited : June 14th 2017

@paulredmond
paulredmond / app.js
Last active September 26, 2020 15:03
Example Vue.js mixins for time
import dateMixin from './mixins/date';
// Globally
Vue.mixin(dateMixin);
@qmchenry
qmchenry / enumCaseName.swift
Created April 21, 2017 18:07
Swift enum name string with associated values
// Swift enums cannot be declared with a rawValue if they have associated values
// like good ol' Amargasaurus has. Using String(describing: dino) on a case with
// associated also includes the values, but works fine on unassociated cases.
// Mirror(reflecting: dino) can extract the name of an associated case, but is
// nil for unassociated cases. Our hero ?? swoops in to save the day!
enum Sauropoda {
case Amargasaurus(things: Int64, hasOtherThing: Bool?)
case Antetonitrus
// ...
@zappycode
zappycode / NSImageToJpeg.swift
Last active December 31, 2023 03:40
Coverting an NSImage into JPEG Data
func jpegDataFrom(image:NSImage) -> Data {
let cgImage = image.cgImage(forProposedRect: nil, context: nil, hints: nil)!
let bitmapRep = NSBitmapImageRep(cgImage: cgImage)
let jpegData = bitmapRep.representation(using: NSBitmapImageRep.FileType.jpeg, properties: [:])!
return jpegData
}
@SidShetye
SidShetye / ExportAlbumAsFolder.applescript
Last active February 1, 2021 14:24
Scan through all albums and export media items (movies, images etc) into a suitable folder. There is custom logic to pick the appropriate destination folder.
------------------------------------------------
-- Settings Start: Change these as needed
global gDest
set gDest to "/Volumes/MacPhotos/Pictures/ExportAlbums/" as POSIX file as text -- the destination folder (use a valid path)
global gLogFile
set gLogFile to gDest & "ExportAlbumToFolders.log"
global gKeywordOnSuccess
set gKeywordOnSuccess to "exported"
@JMichaelTX
JMichaelTX / JXA Resources.md
Last active June 1, 2024 17:33
JavaScript for Automation (JXA) Resources

JXA Resources

Revised: 2019-11-28 16:16 GMT-6

JXA

This is a list of the key resources I have found useful. If you know of others, please post in a comment below, and I will add to this list.

I have tried to order this list in the order that, to me, is best for learning JXA from scratch. We all learn a bit diferently, so adjust to suit your style/needs. Please post if you have suggestions on learning JXA.

@somebox
somebox / osx-setup.sh
Last active December 11, 2021 13:05 — forked from foz/osx-setup.sh.md
Set up an OSX machine from zero to awesome. Uses Homebrew (and cask, fonts, etc). Focused on Ruby/Rails development, includes rvm, xquartz, editor fonts, sublime text, and many tools.
#!/bin/bash
# A script to set up a new mac. Uses bash, homebrew, etc.
# Focused for ruby/rails development. Includes many utilities and apps:
# - homebrew, rvm, node
# - quicklook plugins, terminal fonts
# - browsers: chrome, firefox
# - dev: iterm2, sublime text, postgres, chrome devtools, etc.
# - team: slack, dropbox, google drive, skype, etc
@omz
omz / Dropbox File Picker.py
Last active May 17, 2020 21:47
Dropbox File Picker.py
# IMPORTANT SETUP INSTRUCTIONS:
#
# 1. Go to http://www.dropbox.com/developers/apps (log in if necessary)
# 2. Select "Create App"
# 3. Select the following settings:
# * "Dropbox API app"
# * "Files and datastores"
# * "(No) My app needs access to files already on Dropbox"
# * "All file types"
# * (Choose any app name)