Skip to content

Instantly share code, notes, and snippets.

View Classy-Bear's full-sized avatar
🎩
Doing magic, speaking to goblins

David Acevedo Classy-Bear

🎩
Doing magic, speaking to goblins
  • Scotiabank
  • Dominican Republic
  • 18:36 (UTC -04:00)
View GitHub Profile
package product.methods;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import java.net.URLDecoder;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
@Classy-Bear
Classy-Bear / stopWatch.js
Created January 17, 2021 04:42
Defining an object. Function vs Classes
function Stopwatch() {
let isStarted = false;
let startTime;
let stopTime;
Object.defineProperty(this, "duration", {
get: () => {
if(startTime && stopTime) {
return (stopTime - startTime) / 1000;
}
@Classy-Bear
Classy-Bear / ElevatedButtonShape.dart
Last active December 7, 2021 15:48
Change the shape property of the new Elevated Button
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: MyHomePage(),
/**
* {@link WordAdapter} is an {@link ArrayAdapter} that can provide the layout for each list
* based on a data source, which is a list of {@link Word} objects.
*
*/
public class WordAdapter extends ArrayAdapter<Word> {
WordAdapter(@NonNull Context context, ArrayList<Word> wordArrayList) {
// Here, we initialize the ArrayAdapter's internal storage for the context and the list.
// the second argument is used when the ArrayAdapter is populating a single TextView.
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Hala para refrescar"),
),
body: list != null
? RefreshIndicator(
key: refreshKey,
child: ListView.builder(
@override
void initState() {
super.initState();
random = Random();
refreshList();
}
Future<Null> refreshList() async {
refreshKey.currentState?.show();
await Future.delayed(Duration(seconds: 2));
import 'dart:math';
var list;
var random;
var refreshKey = GlobalKey<RefreshIndicatorState>();
class PdfViewPage extends StatefulWidget {
final String path;
const PdfViewPage({Key key, this.path}) : super(key: key);
@override
_PdfViewPageState createState() => _PdfViewPageState();
}
class _PdfViewPageState extends State<PdfViewPage> {
int _total_de_paginas = 0;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Abrir pdf"),
),
body: Center(
child: Builder(
builder: (context) => Column(
String assetPDFPath = "";
String urlPDFPath = "";
@override
void initState() {
super.initState();
getFileFromAsset("assets/mypdf.pdf").then((f) {
setState(() {
assetPDFPath = f.path;