Skip to content

Instantly share code, notes, and snippets.

@stammy
stammy / LiquidBlobs.swift
Last active July 24, 2024 14:49
Liquid Blob effect with SwiftUI
//
// ContentView.swift
// LiquidCircles
//
// Created by Paul Stamatiou on 10/10/22.
//
import SwiftUI
struct ContentView: View {
@stammy
stammy / ContentView.swift
Created January 4, 2022 02:54
Better Password Field
//
// ContentView.swift
// BetterPasswordField
//
// Created by Paul Stamatiou on 1/3/22.
// Idea from https://twitter.com/Stammy/status/1478108590066089987
//
import SwiftUI
@stammy
stammy / TipsView.swift
Created July 4, 2020 17:24
SwiftUI MicroAnimation example
//
// TipsView.swift
// Stonks
//
// Created by Paul Stamatiou on 7/3/20.
//
import SwiftUI
import PlaygroundSupport
@stammy
stammy / jsonPlayground.swift
Created April 11, 2020 20:59
swift json codable with dynamic key
// this uses a dynamic coding key (StockKey) but does not work with nested objects (ideally quote should have many properties inside
import SwiftUI
import Combine
import Foundation
/* todo modify to work with json in format:
{
"AAPL":{"quote":{},"chart":[]},
"MSFT":{"quote":{},"chart":[]}
[458 pstam-blog]$ s3_website push
[info] Ignoring the extensionless_mime_type setting in /Users/stammy/code/pstam-blog/s3_website.yml. Counting on Apache Tika to infer correct mime types.
[info] Deploying /Users/stammy/code/pstam-blog/_site/* to no-www.paulstamatiou.com
[fail] Failed to upload feed/ (The website redirect location must have a prefix of 'http://' or 'https://' or '/'. (Service: Amazon S3; Status Code: 400; Error Code: InvalidRedirectLocation; Request ID: 1317F27ED7AECE65))
[fail] Failed to upload about (The website redirect location must have a prefix of 'http://' or 'https://' or '/'. (Service: Amazon S3; Status Code: 400; Error Code: InvalidRedirectLocation; Request ID: E3016510B36CBE9D))
[fail] Failed to upload feed (The website redirect location must have a prefix of 'http://' or 'https://' or '/'. (Service: Amazon S3; Status Code: 400; Error Code: InvalidRedirectLocation; Request ID: 5592047C96256EB6))
[fail] Failed to upload search (The website redirect location must have a prefix of 'htt
onfiguration file: /Users/stammy/code/pstam-blog/_config.yml
Source: .
Destination: ./_site
Generating...
Liquid Exception: comparison of Jekyll::Document with Jekyll::Document failed in photos/index.html
/Users/stammy/code/jekyll/lib/jekyll/filters.rb:214:in `sort': comparison of Jekyll::Document with Jekyll::Document failed (ArgumentError)
from /Users/stammy/code/jekyll/lib/jekyll/filters.rb:214:in `sort'
from /Users/stammy/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/liquid-2.5.5/lib/liquid/strainer.rb:43:in `invoke'
from /Users/stammy/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/liquid-2.5.5/lib/liquid/context.rb:75:in `invoke'
from /Users/stammy/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/liquid-2.5.5/lib/liquid/variable.rb:50:in `block in render'
@stammy
stammy / gist:47886744a65276b3f176
Created June 8, 2014 23:23
jekyll sort date issue
[458 pstam-blog]$ /Users/stammy/code/jekyll/bin/jekyll build --watch --trace
Configuration file: /Users/stammy/code/pstam-blog/_config.yml
Source: .
Destination: ./_site
Generating...
Liquid Exception: comparison of Jekyll::Document with Jekyll::Document failed in photos/index.html
/Users/stammy/code/jekyll/lib/jekyll/filters.rb:215:in `sort': comparison of Jekyll::Document with Jekyll::Document failed (ArgumentError)
from /Users/stammy/code/jekyll/lib/jekyll/filters.rb:215:in `sort'
from /Users/stammy/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/liquid-2.5.5/lib/liquid/strainer.rb:43:in `invoke'
from /Users/stammy/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/liquid-2.5.5/lib/liquid/context.rb:75:in `invoke'
#!/bin/bash
VIDEOS=~/Dropbox/_vid
find "$VIDEOS" -name '*.mp4' -exec sh -c 'ffmpeg -i "$0" -c:v libvpx -crf 10 -b:v 3000k -f webm -vf scale=-1:720 -bufsize 1500k -quality good -cpu-used 0 -qmin 10 -qmax 42 -c:a libvorbis -threads 8 "${0%%.mp4}.webm"' {} \;
find "$VIDEOS" -name '*.mp4' -exec sh -c 'ffmpeg -i "$0" -vf scale=-1:720 -quality good -cpu-used 0 -threads 8 "${0%%.mp4}_720p.mp4"' {} \;
# square video
#find "$VIDEOS" -name '*.mp4' -exec sh -c 'ffmpeg -i "$0" -c:v libvpx -crf 10 -b:v 3000k -f webm -aspect 1 -vf "scale=-1:720, crop=720:720" -bufsize 1500k -quality good -cpu-used 0 -qmin 10 -qmax 42 -c:a libvorbis -threads 8 "${0%%.mp4}.webm"' {} \;
#find "$VIDEOS" -name '*.mp4' -exec sh -c 'ffmpeg -i "$0" -aspect 1 -vf "scale=-1:720, crop=720:720" -quality good -cpu-used 0 -threads 8 "${0%%.mp4}_720p.mp4"' {} \;
exit;
{
"color_scheme": "Packages/Color Scheme - Default/Blackboard.tmTheme",
"file_exclude_patterns":
[
"_site/*"
],
"font_face": "monaco",
"font_size": 10.5
}
@stammy
stammy / _media-queries.scss
Last active December 20, 2019 11:57 — forked from anthonyshort/_media-queries.scss
because you should be using ems for accessibility (zoom level) in your media queries
// $mq-mobile-portrait : 320px !default;
// $mq-mobile-landscape : 480px !default;
// $mq-tablet-portrait : 640px !default; -- changed because i want my blog content is around this wide, not 768. you should let content & design determine your breakpoints
// $mq-tablet-landscape : 1024px !default;
// $mq-desktop : 1382px !default;
$mq-mobile-portrait : 20em !default;
$mq-mobile-landscape : 30em !default;
$mq-tablet-portrait : 40em !default;
$mq-tablet-landscape : 64em !default;