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
/* | |
* Copyright (C) 2008 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
/** | |
* Oh yeah | |
*/ | |
function rotate(id) { | |
var element = document.getElementById(id); | |
function applyRotate(angle) { | |
var strAngle = "rotate(" + angle + "rad)"; | |
element.style.WebkitTransform = strAngle; | |
element.style.MozTransform = strAngle; | |
} |
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
<link rel="import" href="../core-menu/core-submenu.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<link rel="import" href="../core-pages/core-pages.html"> | |
<link rel="import" href="../paper-radio-group/paper-radio-group.html"> | |
<link rel="import" href="../paper-radio-button/paper-radio-button.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> |
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
jetpack.statusBar.append({ | |
html: "<input type='button' value='Disable Javascript' id='jsEnabler' />", | |
onReady: function(widget){ | |
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(""); | |
var jsEnabled = prefs.getBoolPref("javascript.enabled"); | |
var button = $(widget).find("#jsEnabler"); | |
if(!jsEnabled) button.val("Enable Javascript"); | |
$(widget).click(function(){ | |
if(jsEnabled) { | |
jetpack.notifications.show( "Disabling Javascript" ); |
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
MCU='atmega328p' | |
F_CPU=16000000 | |
PORT='/dev/ttyACM0' | |
UPLOAD_RATE=115200 | |
SOURCES=main.c | |
all: compile | |
compile: build/main.hex |
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
#!/usr/bin/env python | |
import subprocess | |
import sys | |
import time | |
def avg(nums): | |
return sum(nums) / len(nums) | |
def main(): | |
if len(sys.argv) < 3: |
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
""" from Paul Moore at | |
http://code.activestate.com/recipes/535141-console-progress-dots-using-threads-and-a-context-/ copied here as a bookmark""" | |
import sys | |
import threading | |
class Ticker(threading.Thread): | |
def __init__(self, msg): | |
threading.Thread.__init__(self) | |
self.msg = msg | |
self.event = threading.Event() |
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
""" | |
>>> import unittest | |
>>> class MyTestCase(TestsTimer, unittest.TestCase): | |
... def test_add(self): | |
... self.assertEqual(1 + 2, 3) | |
>>> suite = unittest.TestLoader().loadTestsFromTestCase(MyTestCase) | |
>>> unittest.TextTestRunner(verbosity=0).run(suite) # doctest:+ELLIPSIS | |
[('test_add', ...)] | |
<unittest.runner.TextTestResult run=1 errors=0 failures=0> | |
""" |
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 DatePickerMixIn(object): | |
def prepare_datefields(self): | |
for field in self.fields: | |
if isinstance(self.fields[field], forms.fields.DateField): | |
self.fields[field].widget.attrs.update({'class':'datepicker'}) |
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
from django.core.management import setup_environ | |
from asyncdb import settings | |
setup_environ(settings) | |
from core.models import Help | |
from eventlet import wsgi | |
import eventlet | |
import websocket |
NewerOlder