Skip to content

Instantly share code, notes, and snippets.

@zqqf16
zqqf16 / IPSecDemo.m
Last active May 29, 2020 08:11
Start IPSec programmatically in iOS 8
- (void)viewDidLoad
{
[super viewDidLoad];
// init VPN manager
self.vpnManager = [NEVPNManager sharedManager];
// load config from perference
[_vpnManager loadFromPreferencesWithCompletionHandler:^(NSError *error) {
@hay
hay / has-overflow-scrolling.js
Created November 7, 2012 16:14
Check if a browser supports the overflow-scrolling CSS property, optionally with a prefix
function hasOverflowScrolling() {
var prefixes = ['webkit', 'moz', 'o', 'ms'];
var div = document.createElement('div');
var body = document.getElementsByTagName('body')[0];
var hasIt = false;
body.appendChild(div);
for (var i = 0; i < prefixes.length; i++) {
var prefix = prefixes[i];
@cookrn
cookrn / _readme.md
Created June 27, 2012 04:19
Compile *.ejs Templates

EJS Compiler

This is used to generate a templates.js file where the keys are template identifiers and the values are the raw, escaped EJS templates.

Templates are semi-compiled server side. Results of compilation are memoized on the client side using Underscore.

This is useful for maintaining multiple template files server-side and compiling them into a client-side script.

This requires the use of the ejs client side library. Requires ejs to be available on window. See: https://github.com/visionmedia/ejs#client-side-support