Skip to content

Instantly share code, notes, and snippets.

View egipermana12's full-sized avatar
💭
programmer magang

Egi Permana egipermana12

💭
programmer magang
  • Indonesia
View GitHub Profile
@egipermana12
egipermana12 / demo.php
Created June 7, 2024 09:58 — forked from freekrai/demo.php
PHP session-based rate limiter for APIs
<?php
date_default_timezone_set('America/Los_Angeles');
session_start();
include("ratelimiter.php");
// in this sample, we are using the originating IP, but you can modify to use API keys, or tokens or what-have-you.
$rateLimiter = new RateLimiter($_SERVER["REMOTE_ADDR"]);
$limit = 100; // number of connections to limit user to per $minutes
$minutes = 1; // number of $minutes to check for.
@egipermana12
egipermana12 / main.dart
Created November 8, 2023 05:26
calculator-layout
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@egipermana12
egipermana12 / main.dart
Created November 8, 2023 04:31
Flexible example
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@egipermana12
egipermana12 / main.dart
Created November 3, 2023 08:48
dart-collection-queque
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
}
@egipermana12
egipermana12 / main.dart
Created November 3, 2023 08:41
dart-collection-map
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
}
@egipermana12
egipermana12 / main.dart
Created November 3, 2023 07:30
dart-collection-set
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
}
@egipermana12
egipermana12 / main.dart
Created November 3, 2023 07:30
dart-collection-set
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
}
@egipermana12
egipermana12 / main.dart
Created November 3, 2023 07:29
dart-collections-list
void main() {
//collections List
List<int>number = [1,2,3,4,5];
List<String>fruits = ['Apple', 'Banana', 'Kiwi'];
print(number);
print(fruits);
List<dynamic> collectionList = [];
collectionList.addAll(['add', 1, 3]);
print(collectionList);
@egipermana12
egipermana12 / main.dart
Created November 3, 2023 07:13
dart-collections
void main() {
//collections List
List<int>number = [1,2,3,4,5];
List<String>fruits = ['Apple', 'Banana', 'Kiwi'];
print(number);
print(fruits);
List<dynamic> collectionList = [];
collectionList.addAll(['add', 1, 3]);
print(collectionList);
@egipermana12
egipermana12 / main.dart
Created November 3, 2023 06:43
dart generic basic
abstract class Shape {
double get area;
}
class Circle extends Shape{
double radius;
Circle({required this.radius});
@override
double get area => 3.14 * radius * radius;