This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For refactoring named imports from top level to individual component imports. | |
// | |
// -import { Box, Button } from '@mui/material'; | |
// +import Box from '@mui/material/Box'; | |
// +import Button from '@mui/material/Button'; | |
// | |
// Why? Because CRA development server runs faster this way. | |
// | |
// Has some bugs but works mostly. | |
// You probably need to modify a few imports manually, and test everything. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Manual test for pygame #2100 | |
Press F to quit and restart the screen | |
""" | |
import pygame | |
#pygame.init() # <- problem doesn't happen at all with this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Decision trees in python using recursion and eval. | |
TREE_SIMPLE = { | |
"expression": 'state["x"] > 1', | |
True: {"result": "b"}, | |
False: {"result": "a"}, | |
} | |
def decide(state, node): | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install specified Python version. | |
# Install only if: | |
# Our current matrix entry uses this Python version AND | |
# Python version is not already available. | |
# from https://raw.githubusercontent.com/matthew-brett/multibuild/11a389d78892cf90addac8f69433d5e22bfa422a/install_python.ps1 | |
$py_exe = "${env:PYTHONPATH}\Python.exe" | |
if ( [System.IO.File]::Exists($py_exe) ) { | |
echo "$py_exe exists" | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# midimusic.py | |
# curl -O https://upload.wikimedia.org/wikipedia/commons/5/55/MIDI_sample.mid | |
import time, sys, pygame | |
pygame.mixer.init() | |
pygame.mixer.music.load('MIDI_sample.mid') | |
pygame.mixer.music.play() | |
while pygame.mixer.music.get_busy(): | |
print('Still playing :)') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- src/video/cocoa/SDL_cocoavideo.h.orig Sat Jul 27 20:21:42 2019 +0200 | |
+++ src/video/cocoa/SDL_cocoavideo.h Tue Jul 30 10:04:46 2019 -0700 | |
@@ -113,9 +113,8 @@ | |
/* Utility functions */ | |
extern NSImage * Cocoa_CreateImage(SDL_Surface * surface); | |
-/* Fix build with the 10.10 SDK */ | |
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 101100 | |
-#define NSEventSubtypeTouch NSTouchEventSubtype | |
+/* Fix build with the 10.11 SDK */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
from pygame.locals import * | |
pygame.init() | |
RES=(160, 120) | |
FPS=30 | |
clock = pygame.time.Clock() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" headless pygame (without a window) playing two sounds one after the other. | |
""" | |
import os, sys, time | |
import pygame | |
import pygame.examples | |
# a pretend video. | |
os.environ["SDL_VIDEODRIVER"] = "dummy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Run a task in a background thread. | |
python3 -m pip install tornado --user | |
python3 tornado_thread.py | |
curl http://localhost:8888/2 | |
See `run_on_executor` documentation: | |
https://www.tornadoweb.org/en/stable/concurrent.html#tornado.concurrent.run_on_executor | |
See for another approach: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pygame | |
import math | |
def draw_aacircle(surface, color, pos, radius, width=0): | |
r, g, b = color | |
position_x, position_y = pos | |
alpha_max = 255 |
NewerOlder