Skip to content

Instantly share code, notes, and snippets.

View gamikun's full-sized avatar
🐷

Gamaliel Espinoza M. gamikun

🐷
View GitHub Profile
@gamikun
gamikun / image_view.dart
Created June 16, 2026 07:06
Image preview
import 'dart:io';
import 'package:app/l10n/app_localizations.dart';
import 'package:flutter/material.dart';
class ImageViewPage extends StatefulWidget {
final ImageProvider? image;
final Future<File?>? fromFile;
const ImageViewPage({super.key, this.image, this.fromFile});
@gamikun
gamikun / attach_image_button_list.dart
Last active June 16, 2026 06:44
attach_image_button_list.dart
import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
import 'package:app/l10n/app_localizations.dart';
import 'package:app/src/extensions/build_context.dart';
import 'package:app/src/ui/swatch.dart';
import 'package:app/src/viewModels/subscription_view_model.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
@gamikun
gamikun / buscamina.vb
Created May 3, 2017 00:40
Buscaminas
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6615
ClientLeft = 60
ClientTop = 345
ClientWidth = 9375
LinkTopic = "Form1"
ScaleHeight = 441
ScaleMode = 3 'Pixel
@gamikun
gamikun / bitpack.php
Created February 25, 2017 21:20
Boolean bitpacking for PHP
<?php
/**
* Given an array of numbers (of 24 bits/hours),
* where each bit of the number is equal to 1 hour,
* validates if the corresponding hour and day is on.
*
* @param $days Array of ~24 bits numbers.
* @param $day Number from 0 to 7
* @param $hour 0 to 23
@gamikun
gamikun / fareEstimator.py
Created June 29, 2016 18:20
CodeFights.UberBot.fareEstimator
def fareEstimator(ride_time, ride_distance, cost_per_minute, cost_per_mile):
estimations = []
for i, rtime in enumerate(ride_time):
rdist = ride_distance[i]
permin = cost_per_minute[i]
permile = cost_per_mile[i]
est = (rtime * permin) + (permile * rdist)
estimations.append(est)
return estimations
# CodeFights perfectCity
def perfectCity(departure, destination):
import math
sx, sy = departure
tx, ty = destination
distances = []
for i in [math.floor, math.ceil]:
x = sx
while (true) {
console.log("je");
}
<!DOCTYPE html>
<html>
<head>
<title>Mi fondo se mueve!</title>
<script type="text/javascript">
window.onload = function() {
document.onmousemove = function(e) {
var x = -(e.clientX/10);
var y = -(e.clientY/10);
this.body.style.backgroundPosition = x + 'px ' + y + 'px';
from __future__ import print_function
import sys
import math
import time
db = []
with open("./lonlat", 'rb') as fi:
for l in fi:
@gamikun
gamikun / RandomWebserviceMD5.py
Last active August 29, 2015 14:15
Random MD5 service in Python
from binascii import hexlify
from os import urandom
from wsgiref.simple_server import make_server
def app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
return [hexlify(urandom(16))]
make_server('', 8000, app).serve_forever()