Skip to content

Instantly share code, notes, and snippets.

View themisir's full-sized avatar
🐒
monke sees, monke does

Misir themisir

🐒
monke sees, monke does
View GitHub Profile
@themisir
themisir / typeof.dart
Created September 5, 2020 19:04
Dart generic type extraction
Type typeOf<T>() => T;
// source: https://stackoverflow.com/a/52891829/7616528

Base64 function for PowerShell

Works like base64 tool on UNIX systems.

base64 [-Decode | -d] <input>

Accepts filename or string input. Specify -Decode (or -d) option to decode input.

Install

@themisir
themisir / signin_with_apple.rb
Created July 8, 2020 23:04
A script to generate secret key for "Sign In in with Apple" service
require "jwt"
key_file = "AuthKey.p8" # Private key file name
$team_id = "XXXXXXXXXX" # Team ID
$key_id = "XXXXXXXXXX" # Key ID
$validity_period = 180 # In days. Max 180 (6 months) according to Apple docs.
$private_key = OpenSSL::PKey::EC.new IO.read key_file
def jwtenc(client_id)
@themisir
themisir / crazy.js
Created June 26, 2020 21:43
Make things go crazy
let crazies = document.querySelectorAll('*')
setInterval(() => crazies = document.querySelectorAll('*'), 3000);
setInterval(() => crazies.forEach(e => {
let x = () => 200 * Math.random() - 100;
e.style.marginTop = x();
e.style.marginLeft = x();
e.style.paddingTop = x();
e.style.paddingBottom = x();
e.style.paddingLeft = x();
e.style.paddingRight = x();
@themisir
themisir / profile.ps1
Created June 1, 2020 10:46
My PowerShell profile
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Agnoster
Function Adb-Connect {
param (
[switch] $d = $false
)
if ($d) {
@themisir
themisir / main.dart
Last active February 7, 2024 09:34
InkWell ripple over Image
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomePage(),
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
String Function(String, String) mergeFunction = (String a, String b) {
return a + b;
};
void main() {
print(mergeFunction('Hello ', 'world'));
}
Future<int> add(int a, int b) async {
return Future.delayed(Duration(seconds: 2)).then((f) {
return a + b;
});
}
Future<int> test(Future<int> Function(int a, int b) func) async {
return await func(3, 2);
}
public void ConfigureServices(IServiceCollection services)
{
services.AddClaimsPrincipalFactory<ClaimsFactory>();
}