Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Stamatiou stammy

View GitHub Profile
@stammy
stammy / TipsView.swift
Created Jul 4, 2020
SwiftUI MicroAnimation example
View TipsView.swift
//
// TipsView.swift
// Stonks
//
// Created by Paul Stamatiou on 7/3/20.
//
import SwiftUI
import PlaygroundSupport
@stammy
stammy / jsonPlayground.swift
Created Apr 11, 2020
swift json codable with dynamic key
View jsonPlayground.swift
// 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":[]}
View gist:8e4aa4e4911372862521
[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
View gist:c6d8a632617b9fdb0e9a
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'
View gist:47886744a65276b3f176
[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'
View convert-videos.sh
#!/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;
View gist:4521106
{
"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 Dec 20, 2019 — forked from anthonyshort/_media-queries.scss
because you should be using ems for accessibility (zoom level) in your media queries
View _media-queries.scss
// $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;
View nginx.conf
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@stammy
stammy / gist:4166118
Created Nov 29, 2012
IAM S3 read-only
View gist:4166118
// AWS IAM S3 Read-only, single bucket policy
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketAcl",
"s3:GetBucketLocation",
"s3:GetBucketNotification",
You can’t perform that action at this time.