Skip to content

Instantly share code, notes, and snippets.

@ipmb
ipmb / sandbox.sb
Created March 18, 2022 16:06
Playing around with sandbox-exec for local development
(version 1)
(allow default)
(debug deny)
(define (home-subpath home-relative-subpath)
;; should be able to use something like (param "HOME_DIR") here, but it's not working for me
(subpath (string-append "/Users/pete" home-relative-subpath)))
;; can't write anywhere or read /Users by default
(deny file-write*)
@pakaysekokenusta
pakaysekokenusta / PY0101EN-2-2-Lists.ipynb
Created December 10, 2020 02:44
Created on Skills Network Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@matthewjberger
matthewjberger / main.rs
Last active December 29, 2022 14:33
Rust callback with non-static lifetime
use anyhow::{bail, Result};
use std::sync::{Arc, RwLock};
struct Processor<'a> {
callback: Box<dyn FnMut() -> Result<()> + 'a>,
}
impl<'a> Processor<'a> {
fn set_callback(&mut self, c: impl FnMut() -> Result<()> + 'a) {
self.callback = Box::new(c);
@dullbananas
dullbananas / EA.elm
Created June 9, 2020 19:24
EA Ports. It's in the game.
module EA exposing (..)
port ea0 : Int -> Cmd msg
port ea1 : Int -> Cmd msg
port ea2 : Int -> Cmd msg
port ea3 : Int -> Cmd msg
port ea4 : Int -> Cmd msg
port ea5 : Int -> Cmd msg
@dullbananas
dullbananas / ImperativeShell.elm
Last active April 17, 2020 04:28
elm concept: writing a shell with elm
-- if elm was imperative
import Console
import Proc
type alias Model =
{ prompt : String
}
@dullbananas
dullbananas / Fraction.elm
Last active April 11, 2020 18:51
Elm extending `number` and `comparable` concept
module Fraction exposing (Fraction, create, toFloat_)
-- See https://discourse.elm-lang.org/t/proposal-extending-built-in-typeclasses/5510/2
type Fraction [ number, comparable ]
= Fraction Int Int
@dullbananas
dullbananas / NeverGonna.elm
Created March 24, 2020 02:35
Totally normal program
module NeverGonna exposing (main)
import Html exposing (..)
main : Html Never -- gonna give you up
main =
let
neverGonna : List String
neverGonna =
# I am ashamed for writing this.
import inspect;
class Cin:
""" time to whip out some python magic """
def __rshift__(self, other):
# I don't want to require that "other" is declared global.
cin = input();
@johnwesonga
johnwesonga / factorial.elm
Last active May 6, 2022 18:03
Factorial in Elm
import Html exposing (text)
fact : Int -> Int
fact n =
case n of
0 -> 1
1 -> 1
_ -> n * fact(n-1)
factorial : Int -> Int
@zmwangx
zmwangx / No longer able to make public gists secret.md
Last active April 11, 2024 22:22
No longer able to make public gists private — message to GitHub

We've been able to toggle visibility of gists since 2014 (https://github.com/blog/1837-change-the-visibility-of-your-gists), but I just noticed that I can no longer make public gists private. That is, when I edit private gists I still see the "Make Public" button, but not the other way round — there's only a "Delete" button when I edit public gists; the "Make Secret" which should be next to it (as shown in the screencast in the linked blog post) is nowhere to be found. I made a screenshot and a screencast demonstrating the issue, both of which are attached. Could you please confirm this issue? Was this an intentional change, and why? Thank you for your attention.

gist-unable-to-make-secret

![gist-unable-to-make-secret](https://cloud.githubusercontent.com/assets/4149852/16898407/c76db210-4c0b-11e6-9108-0450f1edebb4.gif)