Skip to content

Instantly share code, notes, and snippets.

View Taishi-Y's full-sized avatar
🏠
Working from home

Taishi Yamasaki Taishi-Y

🏠
Working from home
View GitHub Profile
import canvas from '@napi-rs/canvas' // For canvas.
import fs from 'fs' // For creating files for our images.
import cwebp from 'cwebp' // For converting our images to webp.
// Load in the fonts we need
GlobalFonts.registerFromPath('./fonts/Inter-ExtraBold.ttf', 'InterBold');
GlobalFonts.registerFromPath('./fonts/Inter-Medium.ttf','InterMedium');
GlobalFonts.registerFromPath('./fonts/Apple-Emoji.ttf', 'AppleEmoji');
// This function accepts 6 arguments:
@ZulianTiger
ZulianTiger / digitalocean-deployment.txt
Last active May 8, 2024 14:57
How to Deploy a Next.js Website to a DigitalOcean Server
***Simple and stripped down version of this post: https://www.coderrocketfuel.com/article/how-to-deploy-a-next-js-website-to-a-digital-ocean-server ***
1. Create a New Droplet On DigitalOcean
a) In the first section, select the Ubuntu operating system for your server
b) In the "Authentication" section, make sure the "Password" option is selected and enter a strong root password for your server.
2. Access Server Using Root
a) ssh root@server_ip_address (connect to server from terminal)
3. Add user (OPTIONAL)
@mrousavy
mrousavy / react-navigation-shared-element-v5-guide.md
Last active June 12, 2022 12:56
React Navigation Shared Element v5 Guide

How to use React Navigation Shared Element v5

Install

Run:

npm i react-navigation-shared-element@next react-native-shared-element
npm i @react-navigation/native@^5.0.9 @react-navigation/stack@^5.1.1
@nandorojo
nandorojo / React Navigation Shared Element Transitions.md
Last active May 6, 2024 16:52
Shared Element Transitions with React Navigation and Expo (2019)

Shared Element Transitions with React Navigation and Expo (2019)

It's 2019, and creating smooth shared element transitions in react native (& expo!) is finally easy.

Ideally, as Pablo Stanley suggests, your app's navigation will use these shared transitions for similar components that appear across screens.

Is it possible to achieve the great experience above using react-native/expo? Now it is.

//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
class Responder: NSObject {
@objc func segmentedControlValueChanged(_ sender: UISegmentedControl) {
UIView.animate(withDuration: 0.3) {
buttonBar.frame.origin.x = (segmentedControl.frame.width / CGFloat(segmentedControl.numberOfSegments)) * CGFloat(segmentedControl.selectedSegmentIndex)
}
    /**
     *     Save and get ArrayList in SharedPreference
     */

    public void saveArrayList(ArrayList<String> list, String key){
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
        SharedPreferences.Editor editor = prefs.edit();
        Gson gson = new Gson();
 String json = gson.toJson(list);
@raphaelbussa
raphaelbussa / CustomSnackbar.java
Last active October 30, 2018 12:01
Helper for inflate custom layout in google support design snackbar
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Raphaël Bussa
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@lvterry
lvterry / getAssetThumbnail.swift
Created March 28, 2016 14:57
Convert PHAsset to UIImage with Swift
// it returns a square thumbnail.
func getAssetThumbnail(asset: PHAsset, size: CGFloat) -> UIImage {
let retinaScale = UIScreen.mainScreen().scale
let retinaSquare = CGSizeMake(size * retinaScale, size * retinaScale)
let cropSizeLength = min(asset.pixelWidth, asset.pixelHeight)
let square = CGRectMake(0, 0, CGFloat(cropSizeLength), CGFloat(cropSizeLength))
let cropRect = CGRectApplyAffineTransform(square, CGAffineTransformMakeScale(1.0/CGFloat(asset.pixelWidth), 1.0/CGFloat(asset.pixelHeight)))
let manager = PHImageManager.defaultManager()
@zonca
zonca / us_universities.csv
Last active February 29, 2024 05:57
List of US University with standard name and homepage address, type any portion of the name or the website in the search box, source https://github.com/endSly/world-universities-csv
name url
Abilene Christian University http://www.acu.edu/
Academy of Art College http://www.academyart.edu/
Adams State College http://www.adams.edu/
Adelphi University http://www.adelphi.edu/
Adler School of Professional Psychology http://www.adler.edu/
Adrian College http://www.adrian.edu/
Agnes Scott College http://www.scottlan.edu/
Air Force Institute of Technology http://www.afit.af.mil/
Alabama Agricultural and Mechanical University http://www.aamu.edu/
@jaydp17
jaydp17 / build.gradle
Created October 30, 2015 03:31
Kotlin and dataBinding
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.mvptestkotlin"