Skip to content

Instantly share code, notes, and snippets.

View sugaith's full-sized avatar
🈁
action = 'to code'; theQuestion = action || ! action; expect(theQuestion).toBe..

Thiago da Silva sugaith

🈁
action = 'to code'; theQuestion = action || ! action; expect(theQuestion).toBe..
View GitHub Profile
@sugaith
sugaith / send_push_notification.sh
Last active December 9, 2025 16:40
sh Script to send APN TO A DEVICE - Apple Push Notification
export APNS_KEY_ID="U8U48-----"
export APNS_TEAM_ID="Z2N42-----"
export APNS_KEY=$(cat << 'EOF'
-----BEGIN PRIVATE KEY-----
<...THE APN KEY CONTENT HERE...>
-----END PRIVATE KEY-----
EOF
)
@sugaith
sugaith / App.tsx
Created November 27, 2025 17:23 — forked from thedewpoint/App.tsx
Auth0 with refresh tokens and expo-auth-session
import { SafeAreaProvider } from 'react-native-safe-area-context';
import * as AuthSession from 'expo-auth-session';
import { RefreshTokenRequestConfig, TokenResponse, TokenResponseConfig } from 'expo-auth-session';
import jwtDecode from 'jwt-decode';
import { useEffect, useState } from 'react';
import { Alert, Platform, Text, TouchableOpacity } from 'react-native';
import { useAsyncStorage } from '@react-native-async-storage/async-storage';
import * as React from 'react'
import * as WebBrowser from 'expo-web-browser';
@sugaith
sugaith / .eslintrc.js
Created September 20, 2021 18:05 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@sugaith
sugaith / BinarySearchTree.js
Created February 14, 2021 19:55 — forked from marcogbarcellos/BinarySearchTree.js
Creating, manipulating and calculating distance between nodes inside a Binary Search Tree
function Node(value){
this.value = value;
this.left = null;
this.right = null;
}
function BinarySearchTree() {
this.root = null;
}
BinarySearchTree.prototype.push = function (val) {
@sugaith
sugaith / index.html
Created September 3, 2020 00:22 — forked from gaearon/index.html
Multiple React components on a single HTML page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@sugaith
sugaith / resetXcode.sh
Created June 4, 2020 15:53 — forked from maciekish/resetXcode.sh
Reset Xcode. Clean, clear module cache, Derived Data and Xcode Caches. You can thank me later.
#!/bin/bash
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
open /Applications/Xcode.app
@sugaith
sugaith / WrapLayout.java
Created March 25, 2020 04:16 — forked from jirkapenzes/WrapLayout.java
Java wrap layout (to swing library)
import java.awt.*;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
public class WrapLayout extends FlowLayout
{
private Dimension preferredLayoutSize;
public WrapLayout()
{
@sugaith
sugaith / firebase notification curl
Created February 24, 2019 02:25 — forked from IsmailShurrab/firebase notification curl
firebase notification curl php
<?php
$url = "https://fcm.googleapis.com/fcm/send";
$token = "your device token";
$serverKey = 'your server token of FCM project';
$title = "Notification title";
$body = "Hello I am from Your php server";
$notification = array('title' =>$title , 'text' => $body, 'sound' => 'default', 'badge' => '1');
$arrayToSend = array('to' => $token, 'notification' => $notification,'priority'=>'high');
$json = json_encode($arrayToSend);
$headers = array();