[ create a new paste ] login | about

fedecarg

Name: Federico Cargnelutti
Email:
Site/Blog: http://www.fedecarg.com/
Location:
Default language:
Favorite languages:
About:

Saved pastes by fedecarg:

Plain Text, pasted on Dec 6:
1
2
3
4
5
GEM
  remote: https://rubygems.org/
  specs:
    active_support (3.0.0)
      activesupport (= 3.0.0)
...
view (163 lines)
PHP, pasted on Nov 24:
1
2
3
4
5
class PostModel extends Model
{
    public function findAll(array $options = array())
    {
        // merge defaults and options
...
view (81 lines)
Plain Text, pasted on Jul 1:
1
2
3
4
5
/*
  When using Zend_Session_SaveHandler_DbTable, it's important to
  create a connection to the database after creating 
  an instance of the adapter class. Otherwise, if there's a problem with the 
  connection, you get a Fatal error: Exception thrown without a stack frame 
...
view (33 lines)
PHP, pasted on Jun 29:
1
2
3
4
5
<?php
class DateIntervalFormat
{
    /**
     * Format an interval value with the requested granularity.
...
view (42 lines, 1 line of output)
Python, pasted on Jun 14:
1
2
3
4
5
"""
Handling date/time data
"""

import time
...
view (92 lines, 54 lines of output)
Python, pasted on Jun 14:
1
2
3
4
5
"""
A list of class objects to mimic a C type array of structures
"""

class Person(object):
...
view (52 lines, 20 lines of output)
Python, pasted on Jun 14:
1
2
3
4
5
"""
File handling in Python
"""

# set up a test string
...
view (242 lines)
Python, pasted on Jun 14:
1
2
3
4
5
"""
Example of a small movie database using a list of class instances load, save, 
add, list, search, edit and delete similar to the previous movie database but 
I added edit and check movie ids for uniqueness. By Ene Uran.
"""
...
view (233 lines, 16 lines of output)
Python, pasted on Jun 14:
1
2
3
4
5
"""
Find the days between 2 given dates
"""

import datetime as dt
...
view (19 lines, 1 line of output)
Python, pasted on Jun 14:
1
2
3
4
5
#!/usr/bin/env python
"""
Provides immediate logging to a text file (using module logging)

Usage:
...
view (46 lines)
Python, pasted on Jun 14:
1
2
3
4
'''
Quick English to Spanish 1-word Translator
'''
import urllib2, sys, re
...
view (44 lines)
Python, pasted on Jun 14:
1
2
3
4
5
'''
Decompressing various archive types with this python script
'''
#!/usr/bin/env python
#
...
view (31 lines)
Python, pasted on Jun 14:
1
2
3
4
5
'''
Using Google Talk as a distributed Twitter client
A distributed Twitter client in the spirit of:
http://blog.labnotes.org/2008/05/05/distributed-twitter-client-in-20-lines-of-code/
'''
...
view (89 lines, 4 lines of output)
Python, pasted on Jun 14:
1
2
3
4
5
'''
Behavior of inherited class variables in python
'''
class Vehicle:
    ENGINES = 1
...
view (48 lines, 8 lines of output)
Python, pasted on Jun 14:
1
2
3
4
5
'''
Compare jpg image files using histogram
Use progressively more costly method to see if two jpg files are different
'''
#!/usr/bin/python
...
view (88 lines)
Python, pasted on Jun 14:
1
2
3
4
'''
Counts the number of words in a given file
'''
#!/usr/bin/env python
...
view (40 lines)
Python, pasted on Jun 14:
1
2
3
4
5
'''
Amazon AWS: Transfer files to an S3 bucket
'''
import mimetypes
import os.path
...
view (28 lines)
Python, pasted on Jun 14:
1
2
3
4
5
'''
Change Python (.py) files to use 4-space indents and no hard tab characters.
Also trim excess spaces and tabs from ends of lines, and remove empty lines
at the end of files.  Also ensure the last line ends with a newline.
'''
...
view (294 lines)
Python, pasted on Jun 14:
1
2
3
4
5
'''
Clean .pyc files
I use Subversion for version control and I don't version the .pyc 
files. Before I issue the status command to see what has changed to my 
source, I issue this script to delete all the .pyc files. 
...
view (20 lines, 4 lines of output)
Python, pasted on Jun 14:
1
2
3
4
'''
Geo Proximity Search with Python and SQL
http://bit.ly/yAgbc
'''
...
view (19 lines, 2 lines of output)
Python, pasted on Jun 14:
1
2
3
4
'''
Twitter Snnipet  
Find out who are you following that's not following you back
http://blog.davidziegler.net/
...
view (22 lines)
Python, pasted on Jun 14:
1
2
3
4
5
'''
Find out who are you following that's not following you back
http://blog.davidziegler.net/
Dependencies python-twitter >= 0.6
'''
...
view (19 lines)
Python, pasted on Jun 11:
1
2
3
4
import mimetypes
import os.path
import sys
import S3 # Get this from Amazon
...
view (25 lines)
Python, pasted on Jun 10:
1
2
3
4
5
from __future__ import division
import math

longitude = float(-2.708077)
latitude = float(53.754842)
...
view (14 lines, 2 lines of output)
Python, pasted on Jun 10:
1
2
3
4
5
import csv

# Batch Processing CSV Files
for Agents in range(1,2):
    for UAVs in range(1,6):
...
view (17 lines, 5 lines of output)
Python, pasted on Jun 10:
1
2
3
4
5
import os, sys 

findcmd = 'grep -R "cherrpy.request" .'

print "Searching...:"
...
view (8 lines, 1 line of output)
Python, pasted on Jun 10:
1
2
3
4
5
import os, sys
def pyc_clean(dir):
    findcmd = 'find %s -name "*.pyc" -print' % dir
    count = 0
    for f in os.popen(findcmd).readlines():
...
view (11 lines, 1 line of output)
PHP, pasted on Feb 16:
1
2
3
4
5
<?php
class Zend_Service_Digg extends Zend_Rest_Client
{
    protected $_uri = 'http://services.digg.com/';
    protected $_params = array();
...
view (92 lines, 1 comment)
PHP, pasted on Feb 15:
1
2
3
4
5
<?php
class Zend_Service_Digg extends Zend_Rest_Client
{
    protected $_uri = 'http://services.digg.com/';
    protected $_params = array();
...
view (89 lines)
Python, pasted on Feb 8:
1
2
3
4
5
set @latitude=53.754842;
set @longitude=-2.708077;
set @radius=20;

set @lng_min = @longitude - @radius/abs(cos(radians(@latitude))*69);
...
view (12 lines)
Python, pasted on Feb 8:
1
2
3
4
5
from __future__ import division
import math

longitude = float(-2.708077)
latitude = float(53.754842)
...
view (14 lines, 2 lines of output)
Python, pasted on Feb 8:
1
2
3
4
5
from __future__ import division
import math

longitude = float(-2.708077)
latitude = float(53.754842)
...
view (14 lines, 2 lines of output)
PHP, pasted on Feb 8:
1
2
3
4
<?php
$longitude = (float) -2.708077;
$latitude = (float) 53.754842;
$radius = 20; // in miles
...
view (12 lines, 2 lines of output)
PHP, pasted on Dec 27:
1
2
3
4
5
<?php
require_once APPLICATION_PATH . '/controllers/ExampleController.php';

class ExampleControllerTest extends ExampleController
{    
...
view (55 lines)
PHP, pasted on Dec 27:
1
2
3
4
5
<?php
require_once dirname(__FILE__) . '/bootstrap.php';
require_once dirname(__FILE__) . '/controllers/AllTests.php';

class AllTests
...
view (22 lines)
PHP, pasted on Aug 29:
1
2
3
4
5
*** FileSyncTask.php    2008-08-28 15:48:07.000000000 -0400
--- FileSyncTask.php.mine       2008-08-28 15:45:26.000000000 -0400
*************** require_once "phing/Task.php";
*** 39,44 ****
--- 39,45 ----
...
view (68 lines)
PHP, pasted on Aug 18:
1
2
3
4
5
<?php
class Book {
  private $_title;

  function __get($key){
...
view (26 lines, 1 line of output)
PHP, pasted on Aug 18:
1
2
3
4
5
<?php
class Book {
  private $properties;

  function __get($property) {
...
view (17 lines, 1 line of output)
PHP, pasted on Aug 17:
1
2
3
4
5
<?php
class Book {
  private $title;

  public function __get($property) {
...
view (42 lines, 1 line of output)
Python, pasted on Aug 17:
1
2
3
4
class Book(object):

    def get_title(self):
        return self.__title
...
view (12 lines, 1 line of output, 1 comment)