Skip to content

Instantly share code, notes, and snippets.

View LivioGama's full-sized avatar

Livio Gamassia LivioGama

View GitHub Profile
@acominotto
acominotto / iap.md
Created May 22, 2024 08:01
Set up with

How to validate payments for ios / android in the backend with react native iap and expo.

Set up react-native-iap

in your project :

npm install react-native-iap

then add react-native-iap to your plugins in app.config.(js|ts) or app.json

import copy
import json
import os
from openai import OpenAI
client = OpenAI(
api_key="<Your api key here>"
)
@statico
statico / useModals.tsx
Created December 19, 2021 18:26
Chakra UI await-able alert, confirm, and prompt modal dialogs
/*
* Usage:
* const { alert, confirm, prompt } = useModals()
* alert("Hey!") // awaitable too
* if (await confirm("Are you sure?")) ...
* const result = await prompt("Enter a URL", "http://")
*/
import React, {
createContext,
@gorgos
gorgos / MultiSwap.sol
Created August 22, 2021 11:04
Example for how to swap multiple tokens in one on Ropsten
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/ISwapRouter.sol";
import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/IQuoter.sol";
import {IERC20, SafeERC20} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/token/ERC20/SafeERC20.sol";
interface IUniswapRouter is ISwapRouter {
@Ribesg
Ribesg / !README.md
Last active June 20, 2022 15:00
How to use a Kotlin MPP library depending on an iOS Framework in a XCode iOS App

This gist demonstrates how to use a Kotlin MPP library which depends on an iOS Framework in a native iOS application (XCode project).

First, see [how the Kotlin MPP Library is built][lib-build].

Key ideas:

  • We can currently only use a single Kotlin MPP library in an iOS project, so we need to create a MPP project local to our iOS XCode project whose sole purpose is to aggregate multiple MPP dependencies into a single Framework.
  • To keep our working environment clean, we create the gradle project in a subdirectory instead of at the root of our iOS XCode project. I name my subdirectory mpp.
  • We need to have the Frameworks used by our dependencies locally, as we only have bindings provided by the cinterop klibs, so we use [Carthage] again.
  • As the only goal of our gradle project is to create a Framework, we only use ios* targets.
  • Our project won't have any source code, but we NEED at least one source file, or Gradle will refuse to build anything, returning just a rude NO-SOURCE. Just create
@jogboms
jogboms / Fastfile
Created August 10, 2018 08:17 — forked from rodydavis/Fastfile
Top-level Fastfile for Flutter
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
@lsavino
lsavino / compilation-optimization.md
Last active July 27, 2022 17:44
Compiler Optimizations, Compiling Optimally, and Whole Modules

DEPRECATED for Xcode 10 🎈

(check out What's New in Swift at 11:40, slide 42)

Whole Module Compilation Optimizations: Why these terms are sometimes misleading

When you look up how to compile swift faster for debug builds, people very earnestly give advice that seems contradictory: you should "try using the whole module optimization flag," and also "never use whole module optimization for debugging". [^1]

This is confusing because some of us are using these two general words:

compilation: "turning text into an executable program"

@nurbek-ab
nurbek-ab / really-right-breakpoints.less
Created November 8, 2017 20:17 — forked from markhowellsmead/really-right-breakpoints.less
The 100% correct way to do CSS breakpoints - LESS variables
/*
Thanks David <3 - https://medium.freecodecamp.com/the-100-correct-way-to-do-css-breakpoints-88d6a5ba1862
*/
@for-phone: ~"screen and (max-width: 44.9375rem)"; // < 720
@for-tablet-only: ~"screen and (min-width: 45rem) and (max-width: 74.9375rem)"; // > 720 < 1199
@for-tablet-portrait-only: ~"screen and (min-width: 45rem) and (max-width: 56.1875rem)"; // > 720 < 900
@for-tablet-portrait-up: ~"screen and (min-width: 45rem)"; // > 720
@for-tablet-landscape-up: ~"screen and (min-width: 56.25rem)"; // > 900
@for-desktop-up: ~"screen and (min-width: 75rem)"; // > 1200
@for-big-desktop-up: ~"screen and (min-width: 112.5rem)"; // > 1800
@nickbutcher
nickbutcher / MainActivity.kt
Last active February 22, 2024 21:17
Demonstrating how to tile a (Vector) Drawable
/*
* Copyright 2017 Google Inc.
*
* 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
*
* http://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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
import UIKit
open class LayerView<Layer: CALayer>: UIView {
public final override class var layerClass: Swift.AnyClass {
return Layer.self
}
public final var concreteLayer: Layer {
return layer as! Layer
}