Skip to content

Instantly share code, notes, and snippets.

View dezinezync's full-sized avatar
🏠
Working from home

Nikhil Nigade dezinezync

🏠
Working from home
View GitHub Profile
@dezinezync
dezinezync / MapKitExtensions.swift
Last active September 28, 2021 11:15 — forked from dionc/MapKitExtensions.swift
Create an MKCoordinateRegion from an array of coordinates. Safely handles coordinates that cross the 180th meridian.
import MapKit
extension MKCoordinateRegion {
init?(coordinates: [CLLocationCoordinate2D]) {
// first create a region centered around the prime meridian
let primeRegion = MKCoordinateRegion.region(for: coordinates, transform: { $0 }, inverseTransform: { $0 })
// next create a region centered around the 180th meridian
@dezinezync
dezinezync / apple trailers
Created April 11, 2021 03:01
apple trailers
http://trailers.apple.com/trailers/home/feeds/studios/fox.json
http://trailers.apple.com/trailers/feeds/data/17602.json
http://trailers.apple.com/trailers/feeds/data/18029.json
<meta name="apple-itunes-app" content="app-id=471966214, app-argument=movietrailers://movie/detail/18029">
http://trailers.apple.com/trailers/disney/pirates-of-the-caribbean-dead-men-tell-no-tales/images/poster.jpg
http://trailers.apple.com/trailers/disney/pirates-of-the-caribbean-dead-men-tell-no-tales/images/poster_2x.jpg
@dezinezync
dezinezync / FourColumns.swift
Created June 24, 2020 08:04 — forked from douglashill/FourColumns.swift
A sample UIKit app that sets up a four column layout with new iOS 14 API on UISplitViewController.
import UIKit
class FourColumnsContainerViewController: UIViewController {
let outerSplitViewController = UISplitViewController(style: .tripleColumn)
let innerSplitViewController = UISplitViewController(style: .doubleColumn)
let primary = makeContentViewController("App")
let secondary = makeContentViewController("Files")
let mainContent = makeContentViewController("File Content")
let inspector = makeContentViewController("Inspector")
@dezinezync
dezinezync / chrome_install_headless.sh
Created May 2, 2017 08:59 — forked from Leotomas/chrome_install_headless.sh
Install Chrome headless on Ubuntu
export CHROME_BIN=/usr/bin/google-chrome
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start
sudo apt-get update
sudo apt-get install -y libappindicator1 fonts-liberation
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
@dezinezync
dezinezync / universal-framework.sh
Last active August 29, 2015 14:25 — forked from cromandini/universal-framework.sh
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@dezinezync
dezinezync / redis-server
Last active February 13, 2018 07:08 — forked from henrikalmer/redis
#!/bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.githubusercontent.com/dezinezync/e77945ea65b10c2677d2/raw/1353f39cdf724972e5d8c14100c8d2428358c19d/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
//
// NSHTTPCookieStorage+FreezeDry.h
//
// Created by Maciej Swic on 19/08/13.
// Modified by Dezinezync on 06/08/14.
//  
// 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
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
// For details, see http://mindsea.com/2012/12/18/downscaling-huge-alassets-without-fear-of-sigkill
#import <AssetsLibrary/AssetsLibrary.h>
#import <ImageIO/ImageIO.h>
// Helper methods for thumbnailForAsset:maxPixelSize:
static size_t getAssetBytesCallback(void *info, void *buffer, off_t position, size_t count) {
ALAssetRepresentation *rep = (__bridge id)info;
NSError *error = nil;