Skip to content

Instantly share code, notes, and snippets.

View spiritinlife's full-sized avatar

George Chailazopoulos spiritinlife

View GitHub Profile
@spiritinlife
spiritinlife / Custom Android Animation for illusion of filling something or progressing
Last active August 29, 2015 14:02
The concept of this Animation is to make an illusion of something getting filled or progressed.In this example i use two images, one is a black box and the other is a red one.The goal is to reveal the red box my animating the dissapearance of the black one.This custom view can be used in any layout with no configuration.
package gr.spiritinlife.AnimationBlackToRedBox;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
@spiritinlife
spiritinlife / HMAC.java
Created November 27, 2014 18:50
HMAC RETROFIT ANDROID
import android.util.Base64;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
public class HMAC {
public static String hmacDigest(String msg, String keyString, String algo) {
@spiritinlife
spiritinlife / getAllDatabaseIndexes.js
Created July 17, 2016 20:53
Mongojs get all database indexes and map them to their collection in an object
"use strict";
var db = require('../db');
var indexes = {};
db.getCollectionNames(function (err, collections) {
for (var i=0; i<collections.length; i++) {
indexes[collections[i]] = [];
(function (i) {
db.collection(collections[i]).getIndexes(function (err, collectionIndexes) {
If you are using Azure web app service or any azure server to host your socketio service and you have more than two instances.
Then in order for all transports in socketio to work and specifically to upgrade from xhr-polling to websockets, you will need
the following:
1) ARRAffinity cookie needs to be enabled. When iis sees this cookie in the request it chooses the requests web server instance. This
is very important for socketio to work since the upgrade to websockets mechanism uses memory as storage and it will not be shared
between instances.
2) Socket.io-client-java needs to be configured to save and send the ARRAffinity cookie. See the librabry in this section
Transports and HTTP Headers. It shows how to read and write to requests and responses that are handled by the lib.
@spiritinlife
spiritinlife / main.dart
Created March 31, 2020 07:06
Issue with OutlineInputBorder and DropdownButtonFormField: Button is not clickable due to decoration
// 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
@spiritinlife
spiritinlife / easy_localization_keys_extractor.dart
Last active January 20, 2022 11:09
Extract language keys from your source code and merge them into existing translations.
/// This is inspired by intl_translation extract command https://github.com/dart-lang/intl_translation/blob/8a5e883d7fe07b0244adbaf3489ceb3b08385483/bin/extract_to_arb.dart
/// and is a slimed down rough version of it. Most of the code is from this package which is an excellent learning resource for anyone who wants
/// to play around with the dart analyzer.
/// This is a rough script, to extract localization keys for the easy_localization library. It will analyze the souce
/// code and find occurrences of tr and plural ( you could add other method names e.g. gender etc ) and extract the argument at index $argumentIndex
/// which should be the translation key. It then merges those keys to your current translated keys and spits the merged version where the
/// untranslated keys have a value of "MISSING".
/// Known issues
/// tr( isSomething ? "true_key" : "false_key", context ) -> will get this as key isSomething ? "true_key" : "false_key"
@spiritinlife
spiritinlife / opentok_dummy_creds.json
Last active January 26, 2021 09:56
opentok_dummy_creds
{
"token" : "T1==cGFydG5lcl9pZD00NTgyODA2MiZzaWc9MmZhMDgzNDIzNzdjOWIyZmFhN2U4MDVmZDQyZmU4MGEzNTdlMmFkYTpzZXNzaW9uX2lkPTFfTVg0ME5UZ3lPREEyTW41LU1UWXhNVFkxTXpZd05EYzROSDRyVm5WdmNHMHpURTlhY1dkSk5WbDJVVmRDT1ZKQ2JVWi1VSDQmY3JlYXRlX3RpbWU9MTYxMTY1NDI1MiZub25jZT0wLjE2MDY2OTE4NDU2MjMyNzYmcm9sZT1wdWJsaXNoZXImZXhwaXJlX3RpbWU9MTYxMTc0MDY1Mg==",
"session_id" : "1_MX40NTgyODA2Mn5-MTYxMTY1MzYwNDc4NH4rVnVvcG0zTE9acWdJNVl2UVdCOVJCbUZ-UH4"
}
{
"address": "109 S Batavia Ave Batavia, IL 60510",
"is_listing_claimed": false,
"is_paid_advertiser": false,
"reviews_count": 6,
"reviews_rating": 4,
"task_id": "test",
"task_url": "https://www.yelp.com/biz/batavia-family-dental-batavia-5?osq=emergency+dentist",
"version": "listing_3",
"website": "bataviadentaloffice.com",
{
"has_next_page": true,
"listings": [
{
"ad_placement": "above_search",
"ad_slot": "0",
"address": "60 Main St",
"is_ad": true,
"name": "Stonehill Dental",
"profile_url": "https://www.yelp.com/biz/stonehill-dental-oswego",
@spiritinlife
spiritinlife / yellowpages_serp_example.json
Created May 16, 2021 13:01
Yellowpages serp example
{
"has_next_page": true,
"listings": [
{
"ad_placement": null,
"ad_slot": null,
"address": [
"Dunkirk, MD 20754",
"10420 Southern Maryland Blvd"
],