Skip to content

Instantly share code, notes, and snippets.

View enyo's full-sized avatar
🙌
Primarily working on Pausly

Matias Meno enyo

🙌
Primarily working on Pausly
View GitHub Profile
/// A channel that the gRPC libray communicates over.
/// This is provided by the gRPC library.
final channel = GrpcWebClientChannel.xhr(Uri.parse('https://your.api.url:8080'));
/// The class [AccountServiceClient] is generated by the gRPC library from
/// your `.proto` definition.
final client = AccountServiceClient(channel);
Future<void> changePassword() async {
/// The message you want to send to the API. It's also generated from your
class AccountService extends AccountServiceBase {
@override
Future<Empty> sendEmailVerification(ServiceCall call, VerificationRequest request) {
// TODO: implement sendEmailVerification
throw UnimplementedError();
}
@override
Future<User> signInWithPassword(ServiceCall call, PasswordSignInRequest request) {
// TODO: implement signInWithPassword
syntax = "proto3";
package dropzone.public_account;
import "shared.proto";
// Very simplified version of our account service.
service AccountService {
rpc SendEmailVerification(VerificationRequest) returns(shared.Empty);
@enyo
enyo / simple_server.dart
Last active September 30, 2021 17:45
Writing server side Dart code
import 'dart:io';
main() async {
final server = await HttpServer.bind(InternetAddress.anyIPv6, 80);
server.listen((HttpRequest request) {
request.response.write('Hello, world!');
request.response.close();
});
}
// Get the template HTML and remove it from the doument.
var previewNode = document.querySelector("#template");
previewNode.id = "";
var previewTemplate = previewNode.parentNode.innerHTML;
previewNode.parentNode.removeChild(previewNode);
var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone
url: "/target-url", // Set the url
thumbnailWidth: 80,
thumbnailHeight: 80,
@enyo
enyo / gist:4726916
Created February 6, 2013 23:37
Tweek dropzone to use another container for file previews
Dropzone.myDropzone.options = {
addedfile: function(file) {
file.previewTemplate = $(this.options.previewTemplate);
this.element.find(".previews").append(file.previewTemplate);
file.previewTemplate.find(".filename span").text(file.name);
file.previewTemplate.find(".details").append($("<div class=\"size\">" + (this.filesize(file.size)) + "</div>"));
}
};
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
import 'dart:async';
Future foo() async {
print('foo() before delay');
await Future.delayed(Duration(milliseconds: 100));
print('foo() after delay');
}
void main() async {