Skip to content

Instantly share code, notes, and snippets.

View nadar71's full-sized avatar
🏠
Working from home

Simone Mapelli nadar71

🏠
Working from home
View GitHub Profile
@objcode
objcode / ConcurrencyHelpers.kt
Last active May 2, 2024 08:05
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 The Android Open Source Project
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ssaurel
ssaurel / MyKeyboard.java
Created June 14, 2018 08:49
MyKeyboard class for the In-App Keyboard tutorial on the SSaurel's Channel
package com.ssaurel.inappkeyboard;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.InputConnection;
import android.widget.Button;
@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active May 15, 2024 19:48
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@HoraceBury
HoraceBury / dragitemscrollview.lua
Created December 30, 2016 14:48
Provides a scrollview widget which can have items dragged off it.
local widget = require("widget")
local function angleOf( ax, ay, bx, by, adjust, positive )
local angle = math.atan2( by-ay, bx-ax ) * 180/math.pi
if (adjust) then
if (type(adjust) ~= "number") then adjust = -90 end
angle = angle - adjust
if (angle < -180) then angle=angle+360 end
if (angle > 180) then angle=angle-360 end
@nadar71
nadar71 / flood.lua
Created October 7, 2016 08:18 — forked from HoraceBury/flood.lua
Flood fill a display object with a Gfx2.0 gradient fill. Can be used to provide the Android Material Design button interaction animation, eg: http://www.google.com/design/spec/components/buttons.html#buttons-flat-raised-buttons
-- ref: http://docs.coronalabs.com/daily/guide/graphics/effects.html#generator.radialgradient
local back, outer, inner = {0,1,0,1}, {0,.9,0,.05}, {0,1,0,.05}
-- backing colour rect
display.newRect( display.actualCenterX*.5, display.actualContentHeight*.25, 220, 220 ).fill = back
-- radial fill rect
local r = display.newRect( display.actualCenterX*.5, display.actualContentHeight*.25, 200, 200 )
local function getRadius( r, xOffset, yOffset )
@greggman
greggman / modal dialog
Created May 11, 2016 09:47
Simple modal dialog for Unity / Unity3D
using UnityEngine;
using System;
// example:
// HFTDialog.MessageBox("error", "Sorry but you're S.O.L", () => { Application.Quit() });
public class HFTDialog : MonoBehaviour {
Rect m_windowRect;
Action m_action;
@popcorn245
popcorn245 / hue_colors.md
Last active December 10, 2023 03:10
XY Color Conversion

FROM HUE DESIGN DOCS

https://github.com/PhilipsHue/PhilipsHueSDK-iOS-OSX/blob/00187a3db88dedd640f5ddfa8a474458dff4e1db/ApplicationDesignNotes/RGB%20to%20xy%20Color%20conversion.md

#Conversion between RGB and xy in the CIE 1931 colorspace for hue The conversion between RGB and xy in the CIE 1931 colorspace is not something Philips invented, but we have an optimized conversion for our different light types, like hue bulbs and LivingColors. It is important to differentiate between the various light types, because they do not all support the same color gamut. For example, the hue bulbs are very good at showing nice whites, while the LivingColors are generally a bit better at colors, like green and cyan.

@NarendraDodiya
NarendraDodiya / StepValueSeekbar.java
Last active April 2, 2021 22:10
seekbar with step value and min max or range values
package tyrantgit.sample;
import android.view.View;
import android.widget.SeekBar;
/**
* Created by narendra on 30/9/15.
*/
public class StepValueSeekbar {
@l4u
l4u / gist:9440f62bb3ed0bb880a6
Last active January 24, 2023 04:24
Create a UIWindow programmatically without using storyboards in swift
window = UIWindow(frame: UIScreen.mainScreen().bounds)
if let window = window {
window.backgroundColor = UIColor.whiteColor()
window.rootViewController = UIViewController()
window.makeKeyAndVisible()
}
-- polygon concave test
require("mathlib")
stage = display.getCurrentStage()
local text = display.newText{ text="- - -", x=display.contentCenterX, y=100, fontSize=24 }
lines = display.newGroup()
lines:insert(display.newGroup())