- read this first: https://www.webkit.org/blog/3476/content-blockers-first-look/
- start by adding a new extension target to your iOS app of type “content blocker”
- launch the app using the main target’s scheme + a call to
SFContentBlockerManager.reloadContentBlockerWithIdentifier()
with the extension’s id inapplication:didFinishLaunchingWithOptions:
to auto-reload the blocker in development mode - if you don’t call
reloadContentBlockerWithIdentifier()
then you need to switch the blocker off and on again in the Safari settings (stop the app in Xcode if the switch is not moving) - use inspector from desktop Safari to inspect the Safari in the simulator in order to find specific things to block
- things like periods in the
url-filter
regexp need to be escaped with double backslashes, e.g.facebook\\.net
- if you use
if-domain
, it needs to be an array, even for one element - domain
foo.com
might not matchwww.foo.com
even though I think it’s supposed to (UPDATE: They've changed it in one of
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GoogleAnalytics | |
@init: (webPropertyId) -> | |
@_initQueue webPropertyId | |
scriptTag = @_createScriptTag() | |
@_injectScriptTag scriptTag | |
true | |
@_initQueue: (webPropertyId) -> | |
window._gaq ?= [] | |
window._gaq.push ['_setAccount', webPropertyId] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myCanvasView = new View({ | |
x:100, y:100, | |
width:200, height:200 | |
}) | |
// Add a nice background color so we see it | |
myCanvasView.style.backgroundColor = "rgba(255,0,0,.5)" | |
// This is the tricky bit, we create a canvas element (so we have a reference to it) and insert it into the view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/a/646643 | |
String::startsWith ?= (s) -> @slice(0, s.length) == s | |
String::endsWith ?= (s) -> s == '' or @slice(-s.length) == s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Minimal Facebook Messenger | |
========================== | |
1. Make a Fluid (http://fluidapp.com/) instance of https://facebook.com/messages/ | |
1. a. (You need to buy the paid version of Fluid to modify UserStyles) | |
2. Apply the below CSS as a Userstyles stylesheet | |
3. Like magic, you can now message without all the cruft of Full Facebook | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<meta charset="utf-8"> | |
<title>Example</title> | |
<style> | |
div { | |
width: 100px; | |
height: 100px; | |
background: black; | |
animation-duration: .5s; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
is_iPhone = Framer.Device.deviceType.includes "apple-iphone" | |
is_iPhonePlus = Framer.Device.deviceType.includes "plus" | |
is_iPhoneNotPlus = is_iPhone and not is_iPhonePlus | |
if is_iPhonePlus and Utils.isFramerStudio() then Framer.Device.content.scale = 3 | |
if is_iPhoneNotPlus and Utils.isFramerStudio() then Framer.Device.content.scale = 2 | |
document.querySelector("head>meta[name=viewport]").setAttribute "content", | |
"width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no" | |
Framer.Device._update() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// by david whyte >:) | |
int[][] result; | |
float t, c; | |
float ease(float p) { | |
return 3*p*p - 2*p*p*p; | |
} | |
float ease(float p, float g) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: | |
//: UserDefaultable.swift | |
//: | |
//: Created by Andyy Hope on 18/08/2016. | |
//: Twitter: @andyyhope | |
//: Medium: Andyy Hope, https://medium.com/@AndyyHope | |
import Foundation | |
// MARK: - Key Namespaceable |
OlderNewer