Skip to content

Instantly share code, notes, and snippets.

View gj84's full-sized avatar

German Jimenez gj84

  • Córdoba, Argentina
View GitHub Profile
@gj84
gj84 / clasePermutador.py
Last active October 6, 2015 13:28
Class to manipulate permutations and find anagrams
import codecs
class Permutador:
def __init__(self):
self.lista = []
self.index = 0
self.anagramas = []
def permutar(self,lista_an,longitud=None,anag_an=[]): #same itertools.permutation, but it's recursive
if longitud == None:
@gj84
gj84 / WxpythonStyle.py
Created August 15, 2012 15:50
Style example on Wxpython
#Source http://hasenj.wordpress.com/2009/04/14/making-a-fancy-window-in-wxpython/
import wx
def GetRoundBitmap( w, h, r ):
maskColor = wx.Color(0,0,0)
shownColor = wx.Color(5,5,5)
b = wx.EmptyBitmap(w,h)
dc = wx.MemoryDC(b)
@gj84
gj84 / imagespreload.js
Created August 21, 2012 13:19
Images preload
function preLoad(){
nameimages = new Array('nimage0','nimage1','nimage2','nimage3','nimagen');
images = {};
loadAllImages();
function loadAllImages(){
for (name in nameimages){
images[nameimages[name]] = new Image();
images[nameimages[name]].onload = function() {
resourceLoaded();
}
@gj84
gj84 / simpleslideshow.html
Created August 27, 2012 04:39
Simple slideshow
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
div#slide {
width: 960px;
height: 400px;
animation: slide 30s;
@gj84
gj84 / wp_link_pages_titled.php
Last active December 14, 2016 17:25
New way to use wp_link_pages to get titleone titletwo as pagination in wordpress
@gj84
gj84 / a_testpy_simulswitchcase_vs_ifelif.py
Last active December 19, 2015 01:09
Comparing a simulated dict-based switch-case sentence vs. a if-else sentence in Python.
#-*- coding: utf-8 -*-
import timeit
class Datatests():
def __init__(self):
self.fns = {'ifelif': {'maximos': [],'minimos': [], 'media': []},
'ifelifcalling': {'maximos': [],'minimos': [], 'media': []},
'simulswitch': {'maximos': [],'minimos': [], 'media': []}}
def test(self,function_name,module_name,parameter,test_repetitions,function_calls):
@gj84
gj84 / plotlyCollatzDropingTimes.py
Created August 1, 2013 12:40
Plot.ly example
#plot.ly Example
#
#This example plot
#https://plot.ly/~GermanJimenez/0/
import plotly
import os
def collatzDropTime(n):
c = 0
@gj84
gj84 / one.py
Created February 28, 2014 04:27 — forked from nessita/one.py
def nessitas_one(iterable): #fixed
"""Return the object in the given iterable that evaluates to True.
If the given iterable has more than one object that evaluates to True,
or if there is no object that fulfills such condition, return None.
>>> nessitas_one((True, False, False))
True
>>> nessitas_one((True, False, True))
False