Skip to content

Instantly share code, notes, and snippets.

View stevemolloy's full-sized avatar

Stephen Molloy stevemolloy

View GitHub Profile
@stevemolloy
stevemolloy / make_a_window.py
Created September 24, 2017 20:49
Initial attempt to make a window with Toga
import toga
from colosseum import CSS
class Duvet(toga.App):
def startup(self):
main_window = toga.Window(self.name, size=(1024, 768))
main_window.app = self
main_box = toga.Box()
@stevemolloy
stevemolloy / conditional_decorator.py
Created September 13, 2017 10:13
Conditional decorator in Python (only slightly modified from a stackoverflow answer)
def conditional_decorator(input_decorator, condition):
def output_decorator(func):
if not condition:
return func
return input_decorator(func)
return output_decorator
@stevemolloy
stevemolloy / numbers.ex
Last active December 13, 2021 18:26
Prime numbers in Elixir
defmodule Numbers do
def prime?(2), do: :true
def prime?(num) do
last = num
|> :math.sqrt
|> Float.ceil
|> trunc
notprime = 2..last
|> Enum.any?(fn a -> rem(num, a)==0 end)

Keybase proof

I hereby claim:

  • I am stevemolloy on github.
  • I am sdmolloy (https://keybase.io/sdmolloy) on keybase.
  • I have a public key whose fingerprint is 6376 D880 F844 2C67 7D16 8DA1 298E 5CF9 6E76 0149

To claim this, I am signing this object: