Skip to content

Instantly share code, notes, and snippets.

View niinyarko's full-sized avatar

Laud Bruce-Tagoe niinyarko

  • GitHub Staff
View GitHub Profile
@sma
sma / star_rating.dart
Created March 24, 2019 11:09
A simple star display and interactive star rating widget
import 'package:flutter/material.dart';
class StarDisplayWidget extends StatelessWidget {
final int value;
final Widget filledStar;
final Widget unfilledStar;
const StarDisplayWidget({
Key key,
this.value = 0,
@arturdev
arturdev / URLRequest+Multipart.swift
Last active February 21, 2023 18:59
URLRequest with multipart support
//
// URLRequest+Multipart.swift
//
// Created by Artur Mkrtchyan on 1/16/19.
// Copyright © 2019 arturdev. All rights reserved.
//
import Foundation
import MobileCoreServices
@narath
narath / faraday_post.rb
Created May 8, 2017 17:24
How to do a x-www-form-urlencoded post with Faraday
require 'faraday'
require 'uri'
data = {
:your_data => "YOUR DATA"
}
url = "some url"
response = Faraday.post(url) do |req|
@wbotelhos
wbotelhos / clear-sidekiq-jobs.sh
Last active October 23, 2024 14:10
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
@vxhviet
vxhviet / matrixScaling.md
Last active July 1, 2024 14:28
Android scale bitmap with the highest quality

Source: StackOverflow

Question: How to scale Bitmap without losing much quality

Answer: Use Matrix instead of Bitmap.createScaledBitmap()

    /**
     * @param bitmap the Bitmap to be scaled
     * @param threshold the maxium dimension (either width or height) of the scaled bitmap
@thomasdarimont
thomasdarimont / LoginStatsRecordingRequiredActionProvider.java
Last active April 6, 2021 10:02
Keycloak RequiredAction for recording user information on login
package de.tdlabs.idm.keycloak.ext.authentication;
import static java.time.LocalDateTime.now;
import static java.util.Arrays.asList;
import java.util.List;
import org.jboss.logging.Logger;
import org.keycloak.Config.Scope;
import org.keycloak.authentication.RequiredActionContext;
@steveliles
steveliles / Foreground.java
Last active January 22, 2024 18:06
Class for detecting and eventing whether an Android app is currently foreground or background (requires API level 14+)
package com.sjl.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import java.util.List;
@bkenny
bkenny / base64_encode.rb
Created August 21, 2013 12:58
Quickly encode a file in ruby to base64
require 'base64'
# Open the file you wish to encode
data = File.open('/Users/bkenny/Desktop/d3cce16ee41411e296c022000a1f980f_101.mp4').read
# Encode the puppy
encoded = Base64.encode64(data)
# Spit it out into one continous string
puts encoded.gsub(/\n/,"")