Skip to content

Instantly share code, notes, and snippets.

View yiss's full-sized avatar
:shipit:

Ilias YAHIA yiss

:shipit:
  • France
View GitHub Profile
@yiss
yiss / encode.ts
Last active June 14, 2023 10:08
Reda stuff
function encode(plainText: string): string {
if (plainText.length === 0) {
return '';
}
const characters = plainText.split('');
let lastChar = characters[0];
let lastCharCount = 0;
let result = '';
for (const c of characters) {
if (c === lastChar) {
@yiss
yiss / index.ts
Created May 9, 2023 13:30
Create an IdentityPool and give it access to S3
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// Create an AWS Cognito Identity Pool
const identityPool = new aws.cognito.IdentityPool("identityPool", {
identityPoolName: "myIdentityPool",
});
// Create an IAM role for authenticated identities
const authenticatedRole = new aws.iam.Role("authenticatedRole", {
@yiss
yiss / ts-boilerplate.md
Created May 19, 2022 13:40 — forked from silver-xu/ts-boilerplate.md
Setup a Node.js project with Typescript, ESLint, Prettier, Husky

Setup a Node.js project with Typescript, ESLint, Prettier, Husky

1_D8Wwwce8wS3auLAiM3BQKA

Starting a personal node project could be easy; starting a team node project could be challenging.

I am a developer currently working in SEEK Australia.

In my experience, common mistakes developer make when starting a projects are:

  • No Linting
@yiss
yiss / main.py
Created February 25, 2022 19:57
Google HashCode 2022
from ast import List
import os
from models import Contributor, Problem, Project, Skill, Role
INPUT_FOLDER = './input'
OUTPUT_FOLDER = './output'
def read_problem(filename: str) -> Problem:
@yiss
yiss / example.dart
Created October 14, 2020 13:45
Mobx Example
import 'package:mobx/mobx.dart';
class Counter {
final count = Observable(0);
// Cant't do this now
// The instance member 'count' can't be accessed in an initializer.
final parity = Computed(() {
return count.value.isEven;
});
}
@yiss
yiss / main.py
Created September 21, 2020 18:37
Issam
from tkinter import *
import operator
NUMBER_OF_ROWS = 8
NUMBER_OF_COLUMNS = 5
root = Tk()
root.geometry("1000x1000")
@yiss
yiss / current_position.dart
Created September 19, 2020 18:30
Mini Spotify # Current Position
final currentPositionProvider = StreamProvider.autoDispose<double>((ref) {
final audioPlayer = ref.watch(audioPlayerProvider);
return audioPlayer.currentPosition
.map((position) => position.inSeconds.toDouble());
});
// Consume the provider using Consumer
Consumer(
builder: (context, watch, child) {
final totalDuration = watch(currentPositionProvider);
return totalDuration.when(
@yiss
yiss / currently_playing_thumbnail.dart
Created September 19, 2020 18:26
Mini Spotify # Currently Playing Thumbnail
class CurrentlyPlayingThumbnail extends ConsumerWidget {
final double height;
final double width;
const CurrentlyPlayingThumbnail({Key key, this.height, this.width})
: super(key: key);
@override
Widget build(BuildContext context, ScopedReader watch) {
final currentlyPlaying = watch(currentlyPlayingProvider);
@yiss
yiss / currently_player_provider.dart
Created September 19, 2020 18:24
Mini Spotify # Currently Playing Provider
final currentlyPlayingProvider =
StreamProvider.autoDispose<AudioTrackModel>((ref) {
final playlist = ref.watch(playlistProvider);
final audioPlayer = ref.watch(audioPlayerProvider);
return audioPlayer.current.map((playing) => playlist[playing.index]);
});
@yiss
yiss / audio_player_provider.dart
Created September 19, 2020 18:21
Mini Spotify # Audio Player Provider
final audioPlayerProvider = Provider.autoDispose<AssetsAudioPlayer>((ref) {
final playlist = ref.watch(playlistProvider);
final audioPlayer = AssetsAudioPlayer();
audioPlayer.open(
Playlist(
audios: playlist
.map((audioTrackModel) => Audio.network(audioTrackModel.audioUrl))
.toList()),
autoStart: false);
return audioPlayer;