Skip to content

Instantly share code, notes, and snippets.

View apparition47's full-sized avatar
📱
(╯°□°)╯︵ ┻━┻

Aaron Lee apparition47

📱
(╯°□°)╯︵ ┻━┻
View GitHub Profile
@hansifer
hansifer / URL regex for JS
Created June 24, 2015 01:19
JavaScript port of URL regex from http://stackoverflow.com/a/190405/384062, including a bug fix and some performance refactoring
/^[a-z](?:[-a-z0-9\+\.])*:(?:\/\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~!\$&'\(\)\*\+,;=:\xA0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB44-\uDB7E][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F][\uDC00-\uDFFD])*@)?(?:\[(?:(?:(?:[0-9a-f]{1,4}:){6}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|::(?:[0-9a-f]{1,4}:){5}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:[0-9a-f]{1,4}:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}(?:[
@willurd
willurd / set-wallpaper.sh
Last active January 18, 2020 11:02
Set the Desktop Background for all of your open Spaces in Mountain Lion
read -e IMAGE;
defaults write com.apple.desktop Background "{default = {ImageFilePath='$IMAGE'; };}"
killall Dock
@crsantos
crsantos / ServiceLocator.swift
Last active May 26, 2020 14:52 — forked from FGoessler/ServiceLocator.swift
A very lightweight ServiceLocator implementation including a module mechanism written in Swift.
import Foundation
public typealias ServiceFactoryClosure<Service> = () -> Service
public protocol ServiceLocatorModule {
func registerServices(_ serviceLocator: ServiceLocator)
}
public class ServiceLocator {
@manmal
manmal / print_advertisingid_usage.sh
Created September 14, 2020 08:51
Find IDFA usage in 3rd party frameworks
for framework in Frameworks/*.framework; do
fname=$(basename $framework .framework)
echo $fname
otool -v -s __TEXT __objc_methname $framework/$fname | grep advertisingIdentifier
done
@samuelcole
samuelcole / ultimate_url_re.js
Created April 14, 2011 19:44
Ultimate Url Regex!
/*
Based off of Gruber's awesome url regex: http://daringfireball.net/2010/07/improved_regex_for_matching_urls
In addition:
- Should match 'example.com', 'google.net', 'google.org'. (only com, net, and org are whitelisted).
- Should not match 'sam@samuelcole.name'.
*/
var URL_RE = /(?:(?=[\s`!()\[\]{};:'".,<>?«»“”‘’])|\b)((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/|[a-z0-9.\-]+[.](?:com|org|net))(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))*(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]|\b))/gi
@keitaito
keitaito / ReadAndWritePlistFile.m
Last active April 28, 2021 14:51
Read and Write Plist File in Objective-C, converted from Swift version written by Rebeloper http://rebeloper.com/read-write-plist-file-swift/
//
// ViewController.m
// ReadAndWritePlistFile
//
// Created by Keita on 3/3/15.
// Copyright (c) 2015 Keita Ito. All rights reserved.
// converted from Swift version written by Rebeloper http://rebeloper.com/read-write-plist-file-swift/
#import "ViewController.h"
@keicoder
keicoder / snippet.m
Last active May 13, 2021 14:02
objective-c : dataModel using plist file and save to documents directory
//dataModel using plist file and save to documents directory
#import "DataModel.h"
#import "Checklist.h" //first time runs the app then create a new Checklist object
@implementation DataModel
#define debug 1
#pragma mark - 다큐먼트 디렉토리
import lldb
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('command script add -f SwiftPrinter.printer pjson')
def printer(debugger, command, result, internal_dict):
debugger.HandleCommand('p print(String(data: try! JSONSerialization.data(withJSONObject:' + command + ', options: .prettyPrinted), encoding: .utf8 )!)')
@CyberPunkCodes
CyberPunkCodes / killadobe.sh
Last active November 21, 2022 16:41
Mac Bash script to kill Adobe Create Cloud and other processes that Adobe forces on us.
#!/bin/bash
echo "\n\n--- Killing Stupid Adobe Auto Load Crap ---\n\n"
launchctl unload -w /Library/LaunchAgents/com.adobe.AdobeCreativeCloud.plist
launchctl unload -w /Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist
echo "\n\n--- Done! ---\n\n"
@dhh
dhh / tracker_blocking.rb
Last active July 27, 2023 14:19
Current list of spy pixels named'n'shamed in HEY, as of April 23, 2020
module Entry::TrackerBlocking
extend ActiveSupport::Concern
included do
has_many :blocked_trackers
end
email_service_blockers = {
"ActiveCampaign" => /lt\.php(.*)?l\=open/,
"AWeber" => "openrate.aweber.com",