View manifest.json
"content_scripts": [ | |
{ | |
"matches": [ | |
"http://*/*", "https://*/*" | |
], | |
"js": [ | |
"scripts/inject.js" | |
], | |
"css": [ | |
"css/animate.css", |
View inject.js
var scripts = document.querySelectorAll("head > script") || []; | |
var reportData = []; | |
for(var i=0; i<scripts.length; i++){ | |
if(scripts[i].innerHTML){ | |
reportData.push({ | |
content : scripts[i].innerHTML | |
}); | |
} | |
} |
View background.html
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="/scripts/settings.js"></script> | |
<script src="/scripts/archive.js"></script> | |
<script src="/scripts/identity.js"></script> | |
<script src="/scripts/ddp.js"></script> | |
<script src="/scripts/meteor.js"></script> | |
<script src="/scripts/background.js"></script> | |
</head> |
View background.js
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse){ | |
// look at the message and see if it has report data | |
// extract data and look for Meteor traces | |
// contact app server | |
// adjust UI | |
}); |
View meteor.js
// poor man's Meteorjs | |
// endpoint should be : ws://yourapplication.meteor.com/websocket | |
var Meteor = { | |
call : function(methodName, params, callback){ | |
var options = { | |
endpoint: ApplicationSettings.meteorSocketEndpoint, | |
SocketConstructor: WebSocket | |
}; |
View call-meteor.js
// report spotting is declared through Meteor.methods({}) on the server | |
Meteor.call('reportSpotting',spotting, function(err,res){}); |
View gist:3430537
from django.views.decorators.http import require_http_methods | |
@require_http_methods(["GET", "POST"]) | |
def my_view(request): | |
# I can assume now that only GET or POST requests make it this far | |
# ... | |
pass |
View gist:3430847
{ | |
background: white; | |
border-radius: 5px; | |
padding: 20px; | |
-moz-box-shadow: inset 0 0 5px #999; | |
-webkit-box-shadow: inset 0 0 6px #757575; | |
box-shadow: inner 0 0 5px #999; | |
} |
View gist:3445229
import uuid | |
uuid.uuid1().hex |
View gist:3445408
from functools import wraps | |
from django.utils.decorators import available_attrs | |
def my_decorator(parameter_name): | |
def decorator(view_func): | |
@wraps(view_func, assigned=available_attrs(view_func)) | |
def _wrapped_view(request, *args, **kwargs): | |
return view_func(request, *args, **kwargs) | |
return _wrapped_view |
OlderNewer