Skip to content

Instantly share code, notes, and snippets.

@sheng168
sheng168 / pac.js
Last active September 13, 2017 13:39
function FindProxyForURL(url, host) {
// If the hostname matches, send direct.
if (dnsDomainIs(host, "intranet.domain.com") ||
shExpMatch(host, "(*.abcdomain.com|abcdomain.com)"))
return "DIRECT";
// If the protocol or URL matches, send direct.
if (url.substring(0, 4)=="ftp:" ||
shExpMatch(url, "http://abcdomain.com/folder/*"))
@sheng168
sheng168 / gist:5877256
Created June 27, 2013 15:10
If you're like me and don't care about non-Google devices and would rather not have yet another background service running, you can easily send GCM notifications from CloudCode.
Parse.Cloud.httpRequest({
method: 'POST',
url: 'https://android.googleapis.com/gcm/send',
headers: {
'Authorization': 'key=' + GCM_API_KEY,
'Content-Type': 'application/json'
},
body: {
registration_ids: gcmRegIds,
data: {
@sheng168
sheng168 / gist:5502894
Created May 2, 2013 15:12
android detect screen on/on
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
public class ScreenReceiver extends BroadcastReceiver {
public static boolean screenOff;
@Override
public void onReceive(Context context, Intent intent) {
@sheng168
sheng168 / gist:5311009
Created April 4, 2013 14:50
parse.com security cloudcode
/*
* set an ACL on object with no permissions
*/
exports.lockDown = function(object) {
acl = new Parse.ACL();
console.log("removing all access");
object.setACL(acl);

Frosted Glass Effect: 1.0.0-beta.1

An implementation of the iOS 7 Frosted Glass Blur in HTML5 with the Ionic Framework.

A Pen by Ionic on CodePen.

License.