Skip to content

Instantly share code, notes, and snippets.

@ngokevin
ngokevin / bookmarklet
Created September 30, 2016 22:35
A-Frame/three.js 360-degree Screenshot Bookmarklet
javascript:(function(){var script=document.createElement('script');script.src='https://rawgit.com/AdaRoseEdwards/f6b96e4ea44c0201bc72879da62e633a/raw/9074d13fdbc540a0b4b578009c2fac79711359ba/equirectangular.js';document.body.appendChild(script);})();
<a-scene physics-world="">
<a-entity geometry="primitive: box" material="color: #166678"
physics-body="mass: 5" position="0 10 -10"></a-entity>
<a-entity geometry="primitive: box; depth: 10; height: 0.1; width: 10"
material="color: #2E3837"
physics-body="mass: 0" position="0 0 -10"></a-entity>
</a-scene>
def create(self, request, *args, **kwargs):
thread = get_object_or_404(CommunicationThread, id=kwargs['thread_id'])
# Validate note.
form = forms.CreateCommNoteForm(request.DATA)
if not form.is_valid():
return Response(form.errors, status=status.HTTP_400_BAD_REQUEST)
# Validate attachment.
attachment_formset = None
on('click', '.install-or-launch', utils._pd(function() {
if (capabilities.firefoxOS) {
// Use WebActivities to launch the preloaded Marketplace.
// TODO: declare web activity on Marketplace's packaged manifest.
var act = new MozActivity({
name: 'marketplace-category',
data: {slug: 'all'}
});
act.onerror = function() {
console.log(this.error.name);
var suite = require('./kasperle').suite();
suite.run('/', function(test, waitFor) {
test('Click close prompt', function(assert) {
suite.evaluate(function() {
// Set chromeless since prompt only shows on browsers.
window.require(['capabilities', 'storage'], function(capabilities, storage) {
capabilities.chromeless = false;
storage.setItem('mktapp-prompt-closed', true);
var suite = require('./kasperle').suite();
suite.run('/', function(test, waitFor) {
test('Click close prompt', function(assert) {
suite.evaluate(function() {
// Set chromeless since prompt only shows on browsers.
window.require(['capabilities', 'storage'], function(capabilities, storage) {
capabilities.chromeless = false;
storage.setItem('mktapp-prompt-closed', true);
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/wsgiref/handlers.py", line 93, in run
self.result = application(self.environ, self.start_response)
File "/Users/ngoke/.virtualenvs/zamboni/lib/python2.6/site-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/Users/ngoke/.virtualenvs/zamboni/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/Users/ngoke/.virtualenvs/zamboni/lib/python2.6/site-packages/django/core/handlers/base.py", line 179, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/Users/ngoke/.virtualenvs/zamboni/lib/python2.6/site-packages/django/core/handlers/base.py", line 111, in get_response
var config = function(attr, val) {
if (val) {
config[attr] = val;
} else {
return config[attr];
}
};
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/home/ngoke/.virtualenvs/zamboni/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/home/ngoke/.virtualenvs/zamboni/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/home/ngoke/.virtualenvs/zamboni/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 179, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/home/ngoke/.virtualenvs/zamboni/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
@ngokevin
ngokevin / searchsuggesttouch
Created December 13, 2012 03:47
Why search suggestions weren't working on touch devices (bug 818013)
The problem was that setInterval would fire off multiple duplicate requests per
second. On each subsequent request would abort the previous request in
processRequest. ajaxCache would store the arguments in the first requests and
not serve the subsequent ones. To handle this, we keep track of the previous
search and only send an ajaxCache request if the search is different from the
previous one. This prevents multiple duplicate requests from blocking each
other by only having one of them be able to make the request.
There is still the problem of backspacing in search suggestions. On each letter
I add to my search query, an ajaxCache request is fired off. As I add more