Skip to content

Instantly share code, notes, and snippets.

Avatar

Damian yungwarlock

View GitHub Profile
@yungwarlock
yungwarlock / main.dart
Last active September 4, 2023 13:26
SchedulerBinding
View main.dart
import 'package:flutter/material.dart';
import "package:flutter/scheduler.dart";
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
View courses_group.dart
/* item.subtitle != null */
/* ? Container( */
/* padding: const EdgeInsets.symmetric( */
/* vertical: 4, */
/* horizontal: 8, */
/* ), */
/* color: Colors.grey[100], */
/* child: Row( */
/* children: [ */
/* CircleAvatar( */
@yungwarlock
yungwarlock / main.js
Created August 21, 2023 13:51
Uploading a file using file stream to firebase storage
View main.js
// async function uploadCourseThumbnail(path: string) {
// const fileID = createID();
// const file = storage.file(`${fileID}.png`);
// file.makePublic();
// return new Promise((resolve, reject) => {
// const publicUrl = file.publicUrl();
View uploadCourse.ts
async function uploadCourseThumbnail(path: string) {
const fileID = createID();
const file = storage.file(`${fileID}.png`);
file.makePublic();
return new Promise((resolve, reject) => {
const publicUrl = file.publicUrl();
fs.createReadStream(path)
@yungwarlock
yungwarlock / nearest_neighbor.ipynb
Created July 2, 2023 01:09
nearest_neighbor.ipynb
View nearest_neighbor.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yungwarlock
yungwarlock / main.dart
Last active June 26, 2023 14:24
Dart Timer
View main.dart
import 'dart:async';
void main() {
int countDown = 60;
bool shouldShowResend = false;
Timer.periodic(const Duration(seconds: 1), (t) {
print(formatTime(countDown));
print(shouldShowResend);
});
View Example bash long and short options
#!/usr/bin/env bash
# Initialize all the option variables.
# This ensures we are not contaminated by variables from the environment.
file=
verbose=0
show_help() {
echo "Hello"
}
@yungwarlock
yungwarlock / pull_request.md
Created April 16, 2022 09:38
Fixing bazel rules_python import issues
View pull_request.md
@yungwarlock
yungwarlock / insertionsort.py
Created February 17, 2022 02:04 — forked from pythonbee/insertionsort.py
Insertion sort in python
View insertionsort.py
def insertionsort(A):
#we start loop at second element (index 1) since the first item is already sorted
for j in range(1,len(A)):
key = A[j] #The next item we are going to insert into the sorted section of the array
i = j-1 #the last item we are going to compare to
#now we keep moving the key back as long as it is smaller than the last item in the array
while (i >= 0) and key < A[i]: #if i == -1 means that this key belongs at the start
A[i+1]=A[i] #move the last object compared one step ahead to make room for key
i=i-1 #observe the next item for next time.
@yungwarlock
yungwarlock / ExampleComponent.js
Created July 14, 2021 00:55 — forked from prokizzle/ExampleComponent.js
useFeatureFlag Example
View ExampleComponent.js
import React from 'react';
import useFeatureFlag from './useFeatureFlag';
import RecommendationsComponent from './Recommendations.js';
const {
DecoratedComponent: Recommendations,
featureEnabled: recommendationsFeatureEnabled,
FeatureFlag
} = useFeatureFlag({
Component: RecommendationsComponent,