Skip to content

Instantly share code, notes, and snippets.

@abichinger
abichinger / pixel_fade.dart
Created June 5, 2023 10:39
Flutter pixel-by-pixel fade-in shader
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
class PixelFade extends StatefulWidget {
final String shaderAsset;
final Widget? child;
final Duration duration;
final int width;
final int height;
@ltOgt
ltOgt / conditional_parent_widget.dart
Created June 29, 2020 14:50
Flutter Widget to conditionally wrap a subtree with a parent without breaking the code tree
import 'package:flutter/widgets.dart';
/// Conditionally wrap a subtree with a parent widget without breaking the code tree.
///
/// [condition]: the condition depending on which the subtree [child] is wrapped with the parent.
/// [child]: The subtree that should always be build.
/// [conditionalBuilder]: builds the parent with the subtree [child].
///
/// ___________
/// Usage:
@Beneboe
Beneboe / how-to-setup-verified-commits.md
Last active June 18, 2024 17:16
How to Setup Verified Commits on Github
class NewsScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() => _NewsScreenState();
}
class _NewsScreenState extends State<NewsScreen> {
final List<String> listItems = [];
final List<String> _tabs = <String>[
"Featured",
@jeffcrouse
jeffcrouse / Hover.cs
Created January 29, 2018 23:34
A handy script for making a Unity GameObject rotate and "wobble" with exposed parameters for speed and amount.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/**
* Lessons:
* 1. Scripts are mini-programs that operate on a GameObject in your scene.
* 2. How to get a component of the GameObject this script is attached to?
* 3. How to modify that component over time.
* 4. FIX IN CLASS: There is actually a shortcut to get the transform of the GameObject.

If you are like me you find yourself cloning a repo, making some proposed changes and then deciding to later contributing back using the GitHub Flow convention. Below is a set of instructions I've developed for myself on how to deal with this scenario and an explanation of why it matters based on jagregory's gist.

To follow GitHub flow you should really have created a fork initially as a public representation of the forked repository and the clone that instead. My understanding is that the typical setup would have your local repository pointing to your fork as origin and the original forked repository as upstream so that you can use these keywords in other git commands.

  1. Clone some repo (you've probably already done this step).

    git clone git@github...some-repo.git
@gunderson
gunderson / FlyCamera.cs
Last active June 27, 2024 15:18
Unity Script to give camera WASD + mouse control
using UnityEngine;
using System.Collections;
public class FlyCamera : MonoBehaviour {
/*
Writen by Windexglow 11-13-10. Use it, edit it, steal it I don't care.
Converted to C# 27-02-13 - no credit wanted.
Simple flycam I made, since I couldn't find any others made public.
Made simple to use (drag and drop, done) for regular keyboard layout
@DanielSWolf
DanielSWolf / Program.cs
Last active July 16, 2024 20:29
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);