Post Overview
-
Text Post
9 years ago+4 4 0Your mom...
Let's just group all those jokes under this discussion. :)
-
Text Post
9 years ago+2 2 0Why do Canadians like jokes in hexadecimal?
Because 7 8 9 A.
-
Text Post
9 years ago+4 4 0Flag and banner
Does someone with better graphical skills than me (ie : any at all) can try to give a shot making those graphics?
Also, what do you think would be a proper symbol / banner for us?
-
Unspecified
9 years agoUnspecified+10 10 0/t/nonenglish - Une tribu pour ceux qui veulent un snapzu sympa pour ceux dont l'anglais n'est pas la langue maternelle
-
Text Post
9 years ago+12 12 0So, what *is* your mother tongue?
-
Text Post
9 years ago+12 12 0/t/nonenglish - A tribe for people interested to grow snapzu for people whose mother tongue is not English
Following the lounge discussion about using languages other than English on snapzu, I thought it would be good to have a tribe for people with a shared interest in having Snapzu as friendly as possible for people speaking all languages.
-
Expression
9 years agoExpression+5 6 1Sur Snapzu, on speak white
-
Current Event
9 years ago+11 11 0Anti-vaccine course brings U of T one step closer to offering a masters of pseudoscience
The university just released a report clearing an anti-vaccine course taught by a homeopath
-
Video/Audio
9 years ago+14 14 0[French] Les Cowboys Fringants - Les étoiles filantes
-
Video/Audio
9 years ago+6 7 1[French] La Bottine souriante - La montagne du loup
Quebec's folk music is Celtic in origin, inherited from Ireland and changed over time to acquire a distinct flavour.
-
Analysis
9 years ago+1 1 0How much would Pepsi pay to get Coke’s secret formula?
The answer is surprisingly, not much at all.
-
Text Post
9 years ago+2 2 0Hi new Pythonistas, so what do you wanna learn?
I've been coding with Python since 15 years now so I know quite a bit about it! :)
I'd like to take the pulse and see what you are eager to learn.
-
Text Post
9 years ago+1 1 0The __name__ == '__main__' technique
If you read code from other Pythonistas, you'll notice that you often find that snippet at the end of their programs:
if __name__ == '__main__': main()
It might look a bit weird at first but there's a sensible reason why we do that.
First, it's a good idea to kickstart your program from the end of the file. Look at this simple code:
def main(): spam() eggs() def spam(): print('Yum! Spam!') def eggs() print('Eggs! Try them with spam!') main()
Runs without a hitch. But what happens if I start with the call to main first?
main() def main(): spam() eggs() def spam(): print('Yum! Spam!') def eggs() print('Eggs! Try them with spam!')
NameError: name 'main' is not defined
Why? Because at the time we see main(), python didn't see the definition of main yet! And if it did, it couldn't run main, because it doesn't know the definitions of spam() and eggs() yet! So putting it last means that it knows what everything is before starting.
You might wonder why we would want that. Why not just rewrite the thing inside out, start with the helper functions first? The answer is top down programming.
This means, starting with most important stuff first and finishing with the nuts and bolts. Imagine I write a pong game, I could have code like this in it:
def main(): setup_field() setup_controls() start_play() def setup_field(): setup_paddles() etc...
If I started with something like draw_rectangles you might wonder why it is there, but if it's called by the function that draws the paddles or the ball, you understand why it's here.
Now, back to the name == 'main' shenanigans.
You probably noticed that it's a weird variable name. In Python, variables with double underscores on both sides are called magic. Magic is things that python does on your behalf without you asking for it directly. It aims to be a low-magic language so when that happens, it puts those underscores to warn you.
The name variable either contains 'main' or the name of the file loaded without the .py part. If you launch a file directly, name is main, if you import it is is the name of the file (also called the module name).
Why do you want that?
Let say you have in your program a program a function called isparrotdead(parrot) (it always returns false). You want to test it so you load your interpreter, do an
import parrot
and your whole program starts because you didn't use the name == 'main' technique!
If anything is unclear, just ask me.
show more -
Text Post
9 years ago+1 1 0Pastebin
Can we add a sticky about pastebin?
It's a good place to share snippets and unlike screenshots, they are copy pastable.
-
Text Post
9 years ago+11 11 0How to make a great banner with content-aware resizing
I just got chiefdom of my tribe and it was lacking a banner so I hung one.
I took this image : http://i.imgur.com/8o0IM0F.jpg
And in one fell swoop, transformed it into what you see on top of /t/quebec
Looks pretty, no?
Here's a video that explains the magic : https://www.youtube.com/watch?v=6NcIJXTlugc (watch it, it's really amazing).
And here's how you do it:
- Get The Gimp
- Get the Liquid Rescale Plugin and install it
- Open your image in The Gimp
- Enter the Liquid Rescaling dialog (it's in the Layer menu)
- Punch in a new dimension
- If necessary, manually pick things that ought to be removed / preserved
- Click the button
- Export as JPEG
And that's it.
show more -
Text Post
9 years ago+2 2 0/t/quebec - The tribe for Québécois and everyone interested in Québec
It's been a dormant tribe for a year with a hit 'n' create chief but we're now that it's woken up again, we grew to 19 users already!
-
Text Post
9 years ago+9 9 0Bienvenue au /t/quebec!
Les changements que j'ai fait à date :
- Changé le logo
- Changé la bannière
- Changé la description ("home of the francophones in North America" me semblait pas cool pour le reste des francophones nord-américain)
- Activé le programme de référencement
Pour le dernier point, la manière que ça marche c'est que j'ai 20 codes d'invitations qui s'auto-remplacent quand utilisés. Donc, comment voulez-vous procéder avec ça?
-
Text Post
9 years ago+13 13 0Let's do it the other way around, post a response and someone else will provide the question.
-
Text Post
9 years ago+5 5 0The admins are geographically biased against us
The admins are vancouverites (which also sounds silly) and this obviously bias them.
-
Text Post
9 years ago+13 13 0Is your pile of stuff to watch / read still at a manageable size?