Skip to content

Instantly share code, notes, and snippets.

View code4fish's full-sized avatar

code4fish

  • Hong Kong
View GitHub Profile
@code4fish
code4fish / webflowSegmentTrackForm.js
Last active April 10, 2024 03:04
Segment Webflow Form Track
const formElemList = document.querySelectorAll("form");
formElemList.forEach((form) => {
form.addEventListener("submit", (e) => {
// on form submission, prevent default
e.preventDefault();
// construct a FormData object, which fires the formdata event
new FormData(form);
});
form.addEventListener("formdata", (e) => {
@code4fish
code4fish / main.dart
Created July 31, 2019 04:37
Simple Flutter wave effect
import 'package:flutter/material.dart';
import 'package:wave/wave.dart';
import 'package:wave/config.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@code4fish
code4fish / main.dart
Created June 6, 2019 08:31
FizzBuzz challenge in Dart
//"Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."
void main() {
for (int i = 1; i <= 100; i++) {
bool a = i % 3 == 0;
bool b = i % 5 == 0;
if (a && b) {
print("FizzBuzz");
} else if (a) {