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
require 'rubygems' | |
require 'activesupport' | |
$KCODE = 'u' | |
class String | |
# Converts the Greek Unicode characters contained in the string | |
# to latin ones (aka greeklish) and returns self. | |
# For unobstructive conversion call the non-bang method 'greeklish' | |
# | |
# example: |
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
development: | |
enable_star: 1 | |
min_infix_len: 3 | |
morphology: stem_en | |
html_strip: 1 | |
charset_type: utf-8 | |
charset_table: "0..9, a..z, _, A..Z->a..z, U+37a, U+386..U+389->U+3ac..U+3af, U+38c..U+38e->U+3cc..U+3ce, U+390,U+391..U+3a1->U+3b1..U+3c1, U+3a3..U+3ab->U+3c3..U+3cb, U+3ac..U+3ce,U+3d0..U+3d7, U+3d8..U+3ef/2, U+3f0..U+3f3, U+3f4->U+3b8, U+3f5, U+3f7..U+3f8/2, U+3f9->U+3f2, U+3fa..U+3fb/2, U+3fc..U+3ff" | |
bin_path: '/usr/local/bin' | |
sql_sock: '/tmp/mysql.sock' | |
test: |
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 1ca98a37b38a07387fc4344ce9df8db0a2885057 Mon Sep 17 00:00:00 2001 | |
From: Panagiotis Papadopoulos <[email protected]> | |
Date: Tue, 29 Jun 2010 19:50:20 +0300 | |
Subject: [PATCH] Added support for multiple query parameters with the same name | |
--- | |
oauth/oauth.py | 12 ++++++++++-- | |
1 files changed, 10 insertions(+), 2 deletions(-) | |
diff --git a/oauth/oauth.py b/oauth/oauth.py |
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
def connect_to_gmail(CREDENTIALS, email, oauth_token, oauth_token_secret): | |
""" | |
Call this function to get an authenticated IMAP connection | |
""" | |
consumer = OAuthEntity(CREDENTIALS[0], CREDENTIALS[1]) | |
access_token = OAuthEntity(oauth_token, oauth_token_secret) | |
xoauth_string = GenerateXOauthString( | |
consumer, access_token, email, 'imap', | |
None, str(random.randrange(2**64 - 1)), str(int(time.time()))) |
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
def _process_body(pl): | |
"""find the final payload (body) of an email""" | |
if type(pl)==StringType: | |
return pl.replace('\r\n>',' ').replace('\r\n',' ').replace('\n\n',' ') | |
elif type(pl)==list: | |
return _process_body(pl[0]) | |
elif type(pl)==InstanceType: | |
return _process_body(pl._payload) | |
else: | |
print type(pl) |
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 google.appengine.api import xmpp | |
import logging | |
import logging.handlers | |
import os | |
DEFAULT_FROM_JID = 'logs@%s.appspotchat.com' % os.environ['APPLICATION_ID'] | |
class XmppLogHandler(logging.Handler): | |
def __init__(self, jid, from_jid): |
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
# Create a role user (no perms). Fire up the console rails c | |
$> Role.create(:title=>'User') | |
# In your Gemfile add | |
gem 'oa-oauth', :require => 'omniauth/oauth' | |
# At the beginning of devise.rb. You can also create a yaml file and instantiate when Rails begin | |
# For shake of simplicity I added the credentials at devise.rb | |
Facebook = Rails.env.development? ? {:app_id => 2621xxx, :secret => 'e81f33d042xxxxx'} : | |
{:app_id => 1749xxx9, :secret => '13c11be6628dc1xxxx'} |
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
# encoding: utf-8 | |
class FuzzyClock | |
@@locales ||= {} | |
@@locales[:en] = { | |
:about => "Είναι σχεδόν %t", | |
:hour => { | |
0 => "δώδεκα", | |
1 => "μία", | |
2 => "δύο", |
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
// http://stackoverflow.com/questions/5931033/how-can-i-know-if-a-javascript-exception-occurred-in-a-phonegap-application-and | |
(function(){ | |
window.onexception = function(e) { | |
console.log("Got an exception ", e, e.stack); | |
}; | |
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
// Collecting all unique affected app version for a given data set | |
var jsonStats = [ | |
{app_versions: ['1.2','1.2.3']}, | |
{app_versions: null}, | |
{app_versions: ['1.2','1.3']} | |
]; | |
var app_versions = _.uniq(_.flatten(_.compact(_.map(jsonStats, function(day){return day.app_versions })))); | |
// ["1.2", "1.2.3", "1.3"] | |
// Bye bye stupid for loops! |
OlderNewer