Skip to content

Instantly share code, notes, and snippets.

View Alezhka's full-sized avatar
🎈
Focusing

Sturov Aleksey Alezhka

🎈
Focusing
View GitHub Profile
@mbove77
mbove77 / optimizeAndCropImage.cloudFunction.js
Created August 21, 2018 18:21
Firebase cloud function to resize and optimize image after upload in cloud storage.
const functions = require('firebase-functions');
const gcs = require('@google-cloud/storage')();
const spawn = require('child-process-promise').spawn;
const mkdirp = require('mkdirp-promise');
const path = require('path');
const os = require('os');
const fs = require('fs');
// // Create and Deploy Your First Cloud Functions
exports.optimizeImages= functions.storage.object().onFinalize((data) => {
@raveesh-me
raveesh-me / main.dart
Created July 7, 2018 00:22
An inherited callback pattern to change InheritedWidget state in flutter
import 'package:flutter/material.dart';
import 'package:flutter_login_manager/splash_screen.dart';
import 'package:flutter_login_manager/model/login_info.dart';
import 'package:flutter_login_manager/model/login.dart' as loginManager;
import 'package:flutter_login_manager/home_screen.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
@bostrot
bostrot / CustomShowDialog.dart
Last active October 25, 2022 09:25
showDialog with rounded corners
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@hetang
hetang / open_email_app.kt
Last active October 10, 2023 16:37
Open Email inbox or compose view in Android
/**
* This function open email compose view and post HTML body
**/
// val body = Html.fromHtml(fragment.resources.getString(R.string.email_body))
fun navToEmailCompose(email: String, subject: String, body: String) {
val intent = Intent(Intent.ACTION_SENDTO,
Uri.parse("mailto:${email}"))
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject)
intent.putExtra(android.content.Intent.EXTRA_TEXT, body)
startActivity(Intent.createChooser(intent, "Email"))
@saintplay
saintplay / counter.function.js
Last active October 17, 2021 17:00
Add counter for Firestore Collection
// functions/income/counter.function.js
'use strict'
const functions = require('firebase-functions')
const admin = require('firebase-admin')
// Prevent firebase from initializing twice
try { admin.initializeApp(functions.config().firebase) } catch (e) {}
@bneiluj
bneiluj / simpleAuction.sol
Created August 11, 2016 16:00
An Ethereum simple auction contract that everyone can send their bids during a bidding period.
contract SimpleAuction {
// Parameters of the auction. Times are either
// absolute unix timestamps (seconds since 1970-01-01)
// or time periods in seconds.
address public beneficiary;
uint public auctionStart;
uint public biddingTime;
// Current state of the auction.
address public highestBidder;
import android.content.Context
import android.content.SharedPreferences
import android.preference.PreferenceManager
import java.util.*
import kotlin.reflect.KProperty
/*
* Android Shared Preferences Delegate for Kotlin
*
* Usage:
@lopspower
lopspower / README.md
Last active July 31, 2024 22:25
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@alphamu
alphamu / TextDrawable.java
Last active May 7, 2023 16:24
An TextDrawable that can be used to draw a String. This can be used anywhere you would normally use a drawable. You can watch the demo video here: https://youtu.be/l1HgpcJhIi0
/**
* Copyright 2016 Ali Muzaffar
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
@mbalex99
mbalex99 / RxFirebase.kt
Last active April 4, 2017 06:52
Firebase Kotlin RxJava
import com.firebase.client.*
import com.firebase.client.core.view.Event
import rx.Observable
import rx.subscriptions.Subscriptions
data class RxFirebasePayload(val dataSnapshot: DataSnapshot, val previousChildKey: String? = null)
class RxFirebase{