Skip to content

Instantly share code, notes, and snippets.

View hanskokx's full-sized avatar

Hans Kokx hanskokx

  • Stockholm, Sweden
View GitHub Profile

Keybase proof

I hereby claim:

  • I am skipmeister123 on github.
  • I am hadak (https://keybase.io/hadak) on keybase.
  • I have a public key whose fingerprint is 81FA 3B5F 459C D9C6 D3FE 9448 3A97 1DB6 73BC 95AA

To claim this, I am signing this object:

@hanskokx
hanskokx / hb_all_books_dl.js
Created January 23, 2017 18:43 — forked from kfatehi/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
this fork downloads all formats and does so without using jquery (since that didnt work for me)
note that if you are in chrome, chrome will not download the pdfs for you by default, to fix this
type “about:plugins” in the address bar and disable chrome's pdf viewer
*/
var pattern = /(MOBI|EPUB|PDF)$/i;

Keybase proof

I hereby claim:

  • I am hanskokx on github.
  • I am hadak (https://keybase.io/hadak) on keybase.
  • I have a public key ASDrIrXNtkZI9UZ_AAJ4eJuS46Uh1SJ62hVIUQBGzHNscQo

To claim this, I am signing this object:

@hanskokx
hanskokx / main.dart
Last active September 6, 2021 20:48
loyalty points
import 'package:flutter/material.dart';
import 'dart:math';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@hanskokx
hanskokx / main.dart
Created July 31, 2022 16:25
Async API example
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
void main() => runApp(const MyApp());
Client http = Client();
Future<Album> createAlbum(String title) async {
@hanskokx
hanskokx / main.dart
Last active July 31, 2022 17:26
Stream example
import 'dart:convert';
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
void main() => runApp(const MyApp());
Client http = Client();
final StreamController streamController = StreamController();
@hanskokx
hanskokx / provider.dart
Last active November 23, 2023 17:45
Flutter Provider example
import 'dart:collection';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
void main() {
runApp(
ChangeNotifierProvider(
create: (context) => ShoppingCartProvider(),
child: const MyApp(),
@hanskokx
hanskokx / inherited_widgets_app_state.dart
Last active August 21, 2022 17:30
Inherited widget state management example
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
const List<Item> inventory = [
Item(name: "Shirt", cost: 12.99),
Item(name: "Shoes", cost: 120.00),
Item(name: "Pants", cost: 63.74),
@hanskokx
hanskokx / cubit.dart
Created August 22, 2022 21:13
Cubit for app state management example
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
void main() {
runApp(
BlocProvider(
create: (context) => ShoppingCartCubit(),
child: const MyApp(),
),
);