Skip to content

Instantly share code, notes, and snippets.

View Stilic's full-sized avatar

Stilic

View GitHub Profile
@mebens
mebens / camera.lua
Created May 8, 2011 20:52
Example code for part 3 of my Cameras in Love2D tutorial series.
camera = {}
camera._x = 0
camera._y = 0
camera.scaleX = 1
camera.scaleY = 1
camera.rotation = 0
function camera:set()
love.graphics.push()
love.graphics.rotate(-self.rotation)
@adam-p
adam-p / Local PR test and merge.md
Last active February 5, 2024 19:39
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@Hasufel
Hasufel / Main.hx
Last active June 20, 2022 18:14
OpenFL/Lime Gamepad implementation example
package;
import openfl.display.Sprite;
import openfl.events.Event;
import lime.ui.Gamepad;
import lime.ui.GamepadAxis;
import lime.ui.GamepadButton;
class Main extends Sprite {
@martinohanlon
martinohanlon / guizero_stopmotion.py
Last active August 29, 2022 20:53
a guizero app which uses the picamera to make stop motion gifs
# This is a simple gui for creating stop motion animations using the Pi camera
# martin@ohanlonweb.com
# stuffaboutcode.com
# Instructions:
# - Connect a camera module
# - Enable the camera (Menu > Preferences > Raspberry Pi Configuration, Interfaces, Camera)
# - Install the relevant modules, open a terminal (Menu > Accessories > Terminal) and run:
# - sudo pip3 install guizero
# - sudo pip3 install imageio
--[[
"semi-manual" garbage collection
specify a time budget and a memory ceiling per call.
called once per frame, this will spread any big collections
over a couple of frames, and "catch up" when there is. This
keeps GC burden much more predictable.
The memory ceiling provides some level of "relief valve" - if
/*
Google currently don't offer a way to easily delete all the passwords that you have saved with them.
So if you need to do that, here is a thing that does that.
Just browse to passwords.google.com, log in, and paste the following into the console.
Of course, posting things you found on the internet into the console is usually a bad idea.
*/
(() => {
let currentButton
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active March 27, 2024 06:09
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

Github to Discord Webhook Tutorial

In this tutorial I'll show you how to create a Github webhook that will post updates from your Github account to a channel in Discord. The steps are simple so follow along!

Create a Webhook in a Discord Channel

First you need to create a webhook in a text channel. We're assuming you have both Manage Channel and Manage Webhooks permissions!

  • Go in a channel properties (Alternatively, Server Settings, Webhooks works too)
@KinoAR
KinoAR / FlxSignalExample.hx
Last active April 19, 2022 09:38
An example of a FlxSignal in action.
import flixel.util.FlxSignal;
// for signals that don't need data, use FlxSignal
var signal = new FlxSignal();
// for signals that need data, use FlxTypedSignal with the correct function type
var stringSignal = new FlxTypedSignal<String->Void>();
function noParamCallback() {
trace('Dispatched void event');
}
@alexAubin
alexAubin / convert_to_packaging_v2.py
Last active January 28, 2022 19:51
Convert yunohost app manifest from v1 to v2
import os
import re
import json
import subprocess
def check_output(cmd):
return (
subprocess.check_output(cmd, shell=True)
.decode("utf-8")