Skip to content

Instantly share code, notes, and snippets.

View jjconti's full-sized avatar
💭
I may be slow to respond.

Juan José Conti jjconti

💭
I may be slow to respond.
View GitHub Profile
@jjconti
jjconti / snake.py
Created October 4, 2019 20:29 — forked from sanchitgangwar/snake.py
Snakes Game using Python
# SNAKES GAME
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint
curses.initscr()
win = curses.newwin(20, 60, 0, 0)
@jjconti
jjconti / gist:3705211df71c9e6e0560b80ba35f0b8f
Created June 8, 2018 17:12
Does pickle store methods?
>>> class A(object):
... pass
...
>>> import pickle
>>> from cStringIO import StringIO
>>> src = StringIO()
>>> p = pickle.Pickler(src)
>>> p.dump(A())
>>> datastream = src.getvalue()
>>> dst = StringIO(datastream)
@jjconti
jjconti / gist:5a26d80ba04e5ff91f03
Created June 25, 2015 15:38
Clojure: maps as keys
;; After https://gist.github.com/jjconti/054e15b5a9a07ecadf33
user=> (def d {:a 1 :b 2 :c 3})
#'user/d
user=> (:b d)
2
user=> (d :b)
2
;; Can dictionaries be keys in another dictionary?
;; What if two dictionaries have each other as keys?
@jjconti
jjconti / gist:054e15b5a9a07ecadf33
Created June 25, 2015 14:09
Clojure: access a map using a key as a function or the map as a function
user=> (def d {:a 1 :b 2 :c 3})
#'user/d
user=> (:b d)
2
user=> (d :b)
2
@jjconti
jjconti / gist:5d21bc836a7348deab08
Created April 9, 2015 16:57
How to create a new branch and follow it
git checkout -b new_branch
git push origin new_branch
git branch --set-upstream-to=origin/new_banch new_brach