Welcome

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

What next?
1. Bookmark us with del.icio.us or Digg Us!
2. Subscribe to this site's RSS feed
3. Browse the site.
4. Post your own code snippets to the site!

# wxGlade: MyFrame.<event_handler>

// description of your code here

def calcular(self, event): # wxGlade: MyFrame.<event_handler>
        # tu edad
        edad = int(self.text_ctrl_edad.GetValue())
        # saldo inicial
        saldo = int(self.text_ctrl_saldo.GetValue())
        # sueldo anual deseado inicial
        sueldo = int(self.text_ctrl_sueldo.GetValue())
        # porcentajes:
        # - incremento de sueldo interanual
        incrementosueldo = int(self.text_ctrl_incrementosueldo.GetValue())
        # - interés adquirido por rentas
        interes = int(self.text_ctrl_interes.GetValue())
        # - interés de impuestos por beneficios
        hacienda = int(self.text_ctrl_hacienda.GetValue())
        anyos = 0
        self.grid_1.DeleteRows(0, self.grid_1.GetNumberRows())
        self.grid_1.ForceRefresh()
        
        while saldo > 0 and anyos < int(self.text_ctrl_anyos.GetValue()):
            # cogemos el sueldo del año
            saldo -= sueldo
            
            # calculamos los beneficios de renta
            beneficios = (saldo/100) * interes
            # pagamos a hacienda
            beneficios -= (beneficios/100) * hacienda
            # añadimos beneficios al saldo
            saldo += beneficios
            
            self.grid_1.AppendRows(1)
            self.grid_1.SetCellValue(self.grid_1.GetNumberRows()-1,0, str(anyos))
            self.grid_1.SetCellValue(self.grid_1.GetNumberRows()-1,1, str(anyos+edad))
            self.grid_1.SetCellValue(self.grid_1.GetNumberRows()-1,2, str(sueldo))
            self.grid_1.SetCellValue(self.grid_1.GetNumberRows()-1,3, str(beneficios))
            self.grid_1.SetCellValue(self.grid_1.GetNumberRows()-1,4, str(saldo))
            #print "año #%s (%3s años) | sueldo = %7d | beneficios = %10.0f | saldo = % 12.2f" % (anyos, anyos+edad, sueldo, beneficios, saldo)
            
            # incrementamos el sueldo del año que viene (IPC)
            sueldo += (sueldo/100) * incrementosueldo
            
            # siguiente año...
            anyos += 1
            
        #print anyos
        event.Skip()

# end of class MyFrame

rapidshare

Rapidshare hotfile dowloand full crack program free indir dowloand
thank you canım benım eger bı gun sevecek olursam arkandan gelirim belki:D

rapidshare


tahks you my friends.benım adım sahırısz


Rapidshare hotfile dowloand full crack program free indir dowloand

Query string to Hash

require 'cgi'
require 'uri'

url = '/videos/list/?sort_order=date-asc&tags=news,popular'
uri = URI.parse(url)
uri_params = CGI.parse(uri.query) # uri_params = {"sort_order"=>["date-asc"], "tags"=>["news,popular"]}

Draw a rectangle using RVG

// description of your code here

<job id='rect01'>
  <script>
  <![CDATA[

  #require 'rvg/rvg'
  #include Magick

  Magick::RVG.dpi = 90

  rvg = Magick::RVG.new(12.cm, 4.cm) do |canvas|
    canvas.viewbox(0, 0, 1200, 400)
    canvas.background_fill = 'white'
    canvas.desc = "Example rect01 - rectangle with sharp corners"
    # Show outline of canvas using 'rect' element
    canvas.rect(1195, 395, 1, 1).styles(:fill=>'none', :stroke=>'blue', :stroke_width=>2)

    canvas.rect(400, 200, 400, 100).styles(:fill=>'yellow', :stroke=>'navy', :stroke_width=>10)
  end


  img = rvg.draw
  img.format = 'png'
  @content_type = 'image/png'
  img.to_blob

  ]]>
  </script>
</job>

viagra sans ordonnance
viagra europe
// description of code here
viagra vente
acheter viagra en france

Formatting data and creating an Excel spreadsheet

// description of your code here

import os
import csv

os.chdir('Desktop')
cwd = os.getcwd()

open_file = open('pdfpub08', 'r')


c = csv.writer(open("salaries.csv", "wb"))

## read the text file and define variables
for line in open_file:
    ##line = open_file.readline()
    institution = line[0]
    last_name = line[10:24]
    first_name = line[25:35]
    middle_initial = line[36]
    epa_or_spa = line[49]
    status = line[52]
    year_hired = line[55:59]
    month_hired = line[59:61]
    termination_code = line[67]
    state_sal = line[70:76]
    nonstate_sal = line[76:82]
    academic_rank = line[92]
    year_of_rank = line[93:97]
    month_of_rank = line[97:99]
    is_paid_different = line[136]
    year_in_state_service = line[140:142]
    month_in_state_service = line[142:144]
    is_teaching_research = line[161]

    grand_total = line[82:88]
    total_sal = int(state_sal) + int(nonstate_sal)

## replace double spaces in names
    last_name = last_name.replace('  ', ' ')
    first_name = first_name.replace('  ', ' ')

    last_name = last_name.replace('  ', ' ')
    first_name = first_name.replace('  ', ' ')

    last_name = last_name.replace('  ', ' ')
    first_name = first_name.replace('  ', ' ')

    last_name = last_name.replace('  ', ' ')
    first_name = first_name.replace('  ', ' ')

    last_name = last_name.replace(' ', '')
    first_name = first_name.replace(' ', '')

## decode the institution names

    if institution == 'A':
        institution = "Appalachian State"
    if institution == 'B':
        institution = "East Carolina"
    if institution == 'C':
        institution = "Elizabeth City State"
    if institution == 'D':
        institution = "Fayetteville State"
    if institution == 'E':
        institution = "N.C. A&T State"
    if institution == 'F':
        institution = "East Carolina"
    if institution == 'G':
        institution = "UNC School of the Arts"
    if institution == 'H':
        institution = "N.C. State"
    if institution == 'I':
        institution = 'UNC-Pembroke'
    if institution == 'J':
       institution = "UNC-Asheville"
    if institution == 'K':
        institution = "UNC-Chapel Hill"
    if institution == 'L':
        institution = "UNC-Charlotte"
    if institution == 'M':
        institution = "UNC-Greensboro"
    if institution == 'N':
        institution = "UNC-Wilmington"
    if institution == 'O':
        institution = "Western Carolina"
    if institution == 'P':
        institution = "Winston-Salem State"
    if institution == 'S':
        institution = "N.C. School of Science and Math"

    
    #format SPA

    if epa_or_spa == 'E':
        epa_or_spa = 'Exempt'
    if epa_or_spa == 'S':
        epa_or_spa = 'SPA'
    if epa_or_spa == 'G':
        epa_or_spa = 'Graduate Assistant'

    # decode termination code

    if termination_code == '0':
        termination_code = 'Currently employed'
    if termination_code == '1':
        termination_code = 'Resigned'
    if termination_code == '2':
        termination_code = 'Retired'
    if termination_code == '3':
        termination_code = 'Dismissed or terminated'
    if termination_code == '4':
        termination_code = 'Deceased'
    if termination_code == '5':
        termination_code = 'Non-reappointment'
    if termination_code == '6':
        termination_code = 'Laid off (EPA only)'
    if termination_code == '7':
        termination_code = 'Other'
    if termination_code == 'P':
        termination_code = 'Terminated after phased retirement'


    # decode academic rank

    if academic_rank == '1':
        academic_rank = 'Professor'
    if academic_rank == '2':
        academic_rank = 'Associate Professor'
    if academic_rank == '3':
        academic_rank = 'Assistant Professor'
    if academic_rank == '4':
        academic_rank = 'Instructor'
    if academic_rank == '5':
        academic_rank = 'Lecturer'
    if academic_rank == '6':
        academic_rank = 'Other'

    # decode salary exceptions

    if is_paid_different == 'T':
        is_paid_different = 'T-grade salary'
    if is_paid_different == 'F':
        is_paid_different = 'Flat-rate salary'
    if is_paid_different == 'A':
        is_paid_different = 'Salary is above range'
    if is_paid_different == 'B':
        is_paid_different = 'Salary is below range'

    # decode teaching/research

    if is_teaching_research == '0':
        is_teaching_research = 'Not a teacher/researcher'
    if is_teaching_research == '1':
        is_teaching_research = 'Half-time teacher/researcher'
    if is_teaching_research == '2':
        is_teaching_research = 'Full-time teacher/researcher'

    #create csv file
        
    c.writerow([institution, last_name, first_name, middle_initial, epa_or_spa, year_hired, month_hired, termination_code, state_sal, nonstate_sal, grand_total, academic_rank, year_of_rank, month_of_rank, is_paid_different, year_in_state_service, month_in_state_service, is_teaching_research])

acheter viagra en suisse
acheter viagra en belgique
// description of code here
cialis vente
acheter cialis en france

ghd iv styler

I received my cheapest ghd iv mini styler today, very impressed. They are like sort

of a massive slipper, soft, easy to wear and light.My ghd iv styler uk arrived

today, I'm very pleased with them. So silky smooth and soft I can't believe it. I researched the whole
href="http://www.hotghdtop.com/"> ghd iv mini styler uk
thing last year but decided not to order because I really

couldn't afford a pair. This year I read about Whooga's in a fashion forum and decided to give them a try. I ordered a size too small

initially and had to return them for a 6 which was a bit annoying but eventually worth the wait, I'm a 5.5 in most shoes but boots sometimes

vary between 5.5 and 6. I probably should have measured my foot, anyway I'm very pleased. cheap

ghd iv mini styler
...

ren - rename files interactively

// description of your code here

#!/usr/bin/perl
#
# ren - rename files interactively
# John Harrison
# 14 August 2006 - from shell version
#
use warnings;
use strict;

use File::Glob qw(:globally :nocase);
use File::Copy;

my $editor = '/bin/vi';

my @files = @ARGV;

die "Usage: $0 FILES\n" unless ($#files >= 0);

print join( $/, @files ), $/;

for my $file (@files) {

    my $tmp = '/tmp/ren.' . $$;

    die "Can't write to '$tmp': $!\n" unless open( TMP, ">$tmp" );

    print TMP "$file";

    close TMP;

    system("$editor $tmp");

    die "Can't read '$tmp': $!\n" unless open( TMP, $tmp );

    chomp( my $new = <TMP> );

    close TMP;

    if ( $new eq $file ) {

        print "'$file': No change.\n";

    }
    elsif ( -f $new ) {

        print "'$new': Already exists.\n";

    }
    else {

        die "Can't rename '$file' to '$new': $!\n" unless move( $file, $new );

        print "mv '$file' -> '$new'\n";
    }

    unlink $tmp;

}

acheter cialis en suisse
acheter cialis en belgique
// description of code here
acheter levitra en france
acheter kamagra en ligne

Make an easy list of your photos

// easy list of your photos

<?
$path = "/the/path/with/your/photos/" ;
$d = dir("$path");
$count = 0;
while($entry=$d->read()) {
  $file = explode(".", "$entry");
  $extens = end($file); 
  $extens = strtolower ($extens);
 
  if ($extens == "jpg" OR $extens == "gif" OR $extens == "bmp") {
    $file[$count] = $entry;
    $count++;
  }
}
sort($file);
reset($file);
for ($i = 0; $i < $count; $i++) {
  echo "<a href='$path/$file[$i]'>$file[$i]</a><br>";
}
?> 


See more on laptop battery battery

CSS image floats no text wrap

// description of your code here

.callout {
float:left;
width:275px;
}

.callout h3 {
width:115px;
height:65px;
float:left;
text-indent:-8008px;
background:transparent url(team-report.gif) no-repeat 0 0;
}

.callout * {
width:160px;
float:right;
}

.callout * * {
width:auto;
float:none;
}

acheter viagra en france
viagra europe
// description of code here
cialis achat en ligne
viagra vente