Skip to content

Instantly share code, notes, and snippets.

@tylermorganwall
tylermorganwall / submarine_cable_map.R
Last active April 19, 2024 07:36
Submarine Cable Map Dataviz
library(geojsonsf)
library(sf)
library(rayrender)
#Data source: https://github.com/telegeography/www.submarinecablemap.com
cables = geojson_sf("cable-geo.json")
cablescene = list()
counter = 1
for(i in 1:length(cables$geometry)) {
@TyrfingMjolnir
TyrfingMjolnir / PrintCoreImageFiltersAndAttributes.swift
Last active February 23, 2024 23:12
This snippet prints the attributes of Core Image filters for the version of the system you are on. https://asciinema.org/a/5tHQvp6g8LUZXnzvRdg7hYqb8
import CoreImage
# CoreImage works with MacOS X, iOS, and iOS for AppleTV
CIFilter.filterNames( inCategory: nil ).map {
let filter = CIFilter( name: $0 )
print( "\n\n\n>>> \($0): \n ---" )
print( filter?.attributes ?? "" )
}
CIFilter.filterNames( inCategory: nil ).map {
@marjanmo
marjanmo / youtube_to_mp3_splitter.py
Last active June 16, 2023 17:46
Download Youtube music compilation into separate .mp3 files
import subprocess
import sys, os
"""
#####################################
##### YOUTUBE TO MP3 SPLITTER ######
#####################################
@andreacipriani
andreacipriani / Bash.swift
Last active February 15, 2024 12:50
Execute shell/bash commands from Swift
import UIKit
protocol CommandExecuting {
func run(commandName: String, arguments: [String]) throws -> String
}
enum BashError: Error {
case commandNotFound(name: String)
}
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"More" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
// maybe show an action sheet with more options
[self.tableView setEditing:NO];
}];
moreAction.backgroundColor = [UIColor lightGrayColor];
UITableViewRowAction *blurAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Blur" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
[self.tableView setEditing:NO];
}];
@steventroughtonsmith
steventroughtonsmith / gist:6763213
Created September 30, 2013 12:39
Non-opaque application windows in iOS 7, with optional blur. Shows the user's wallpaper under the app, with Parallax if supported.
typedef enum _UIBackgroundStyle {
UIBackgroundStyleDefault,
UIBackgroundStyleTransparent,
UIBackgroundStyleLightBlur,
UIBackgroundStyleDarkBlur,
UIBackgroundStyleDarkTranslucent
} UIBackgroundStyle;
@interface UIApplication (UIBackgroundStyle)
-(void)_setBackgroundStyle:(UIBackgroundStyle)style;
@goshacmd
goshacmd / fix_sys_rb.sh
Created June 12, 2013 07:41
OS X [REDACTED] Ruby 2.0 headers fix.
sys_rb_usr=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sdk_rb_usr=`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sudo cp -r $sdk_rb_usr/include $sys_rb_usr/include
@benvium
benvium / resizer.txt
Last active September 3, 2018 13:30 — forked from gingertom/resizer.sh
Resize all @3x images in a folder to @2x and @1x sizes. Using this script you need only ever edit the @3x images. Drop this script into the folder containing your images and double-click it in Finder to run. Note it will destructively overwrite the @2x and @1x-sized images, so be careful. Don't run this script in a folder that's not under versio…
#!/bin/bash -e
# Ensure we're running in location of script.
cd "`dirname $0`"
for f in *; do
if [[ $f == *@3x* ]];
then
echo "$f -> ${f//@3x/@2x}, ${f//@3x/}"
convert "$f" -resize 66.66666% "${f//@3x/@2x}"

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/
  Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'

UIActivityIndicatorView

@cliss
cliss / gist:5374387
Last active November 27, 2019 19:06
Best of Top Gear
+----------------------------------------------+
| Series | Episode | Description |
+--------+---------+---------------------------+
| 5 | 5 | Jaguar at the Nurburgring |
| 5 | 8 | Race to Verbier |
| 8 | 0 | Winter Olympics Special |
| 8 | 3 | Amphibious Cars |
| 8 | 6 | Caravan Vacation |
| 9 | 3 | America Special |
| 10 | 0 | Polar Special |