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 |
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 os | |
import dalton | |
from django.test import TestCase | |
from django.conf import settings | |
class DaltonTestCase(TestCase): | |
ROOT_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), | |
"replay") |
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 urllib2 | |
import json | |
import urllib | |
API_URL = "http://search.twitter.com/search.json" | |
def find_a_tweet_without_twitter_stuff(tweets): | |
for tweet in tweets: | |
if not ("#" in tweet or "@" in tweet or "http://" in tweet): | |
yield tweet |
NewerOlder