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 __future__ import print_function | |
from difflib import SequenceMatcher | |
def mean(numbers): | |
""" | |
Returns the arithmetic mean of a numeric list. | |
see: http://mail.python.org/pipermail/python-list/2004-December/294990.html | |
""" | |
return float(sum(numbers)) / float(len(numbers)) |
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
public class LostMobile extends Activity { | |
// [... snip ...] | |
mMainRecycler = (RecyclerView) findViewById(R.id.mainList); | |
mMainRecycler.setHasFixedSize(true); | |
mMainRecycler.setLayoutManager(new LinearLayoutManager(this)); | |
mMainListAdapter = new MyAdapter(this, remoteMap); | |
// [... snip ...] | |
mMainRecycler.setAdapter(mMainListAdapter); |
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
/** | |
* Remove all files and folders that are older than a set number of days. | |
* | |
* @param rootURI The URI of the root folder. All old files and folders in this | |
* folder are removed. | |
* @param days Files older than this number of days are deleted | |
*/ | |
function purgeFiles(rootURI, days) { | |
var fso = new ActiveXObject("Scripting.FileSystemObject"); |
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
/** | |
* Naive CSV splitter | |
* | |
* This splitter is *very* simplistic and may result in errors when parsing | |
* unknown CSV sources. This works well in the current problem domain. | |
* | |
* As we have well defined data, with no escaped quotes inside the fields, we | |
* can sefaly assume that this will work. | |
*/ | |
function simpleCsvSplit(lineText){ |
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 dbus.mainloop.glib | |
import gobject | |
from subprocess import Popen | |
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) | |
def screensaver_state_changed(new_state): |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
These files represent the different parts for the customisation for the PostgreSQL docs.
- shrinks the page width
- changes to colors (based on http://ethanschoonover.com/solarized)
- Changes the font-family and line-height
All to make the page a bit more readable
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 ConfigParser import SafeConfigParser | |
from os import getenv, pathsep, getcwd | |
from os.path import expanduser, exists, join | |
import logging | |
LOG = logging.getLogger(__name__) | |
CONF = None | |
def config(group, app, search_path=None, conf_name=None, force_reload=False): | |
""" |
OlderNewer