This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[] == ![] // -> true | |
Math.min() > Math.max() // -> true | |
a: b: c: d: e: f: g: 1, 2, 3, 4, 5; // -> 5 | |
(1).__proto__.__proto__.__proto__ // -> null | |
(0.1 + 0.2) === 0.3 // -> false | |
//More funny code samples: https://github.com/denysdovhan/wtfjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initPaddle(){ | |
//Init the Paddle after it's loaded from their server. | |
//There is no callback or an event so we use intervals to wait until it's loaded. | |
//We also must load their script from their servers to get the freshest code. | |
let interval = setInterval(() => { | |
if (typeof window.Paddle !== 'undefined') { | |
//Credentials: https://vendors.paddle.com/account | |
window.Paddle.Setup({ | |
vendor: 11111, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import firebase from "firebase/app"; | |
import 'firebase/auth'; | |
import StyledFirebaseAuth from 'react-firebaseui/StyledFirebaseAuth'; | |
initAuth(){ | |
var config = { | |
apiKey: "<key>", | |
authDomain: "unicorn-platform-app.firebaseapp.com", | |
databaseURL: "https://unicorn-platform-app.firebaseio.com", | |
projectId: "unicorn-platform-app", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checkIfPro(){ | |
// Send email and PRO_PRODUCT_ID to check.php. | |
// check.php must get the list of all users from Paddle, then see if current user is among Pro users. | |
const userEmail = "[email protected]"; | |
const PRODUCT_ID = 11111; //See this ID in the Paddle dashboard. | |
const URL = 'https://unicornplatform.com/api/check.php'; | |
const data = { | |
email: userEmail, | |
productID: PRODUCT_ID | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Checks if user a Pro. If Pro send also his last/next payment info. | |
$checking_user_email = json_decode(file_get_contents('php://input'))->email; | |
$product_id = json_decode(file_get_contents('php://input'))->productID; | |
curl_init('https://vendors.paddle.com/api/2.0/subscription/users'); | |
//https://paddle.com/docs/api-list-users/ | |
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{"english": "english", "native": "English", "flag": "🇺🇸🇬🇧", "code": "en"}, | |
{"english": "chinese", "native": "Zhongwen", "flag": "🇨🇳", "code": "zh"}, | |
{"english": "spanish", "native": "Espanol", "flag": "🇪🇸", "code": "es"}, | |
{"english": "french", "native": "Francais", "flag": "🇫🇷", "code": "fr"}, | |
{"english": "japanese", "native": "Nihongo", "flag": "🇯🇵", "code": "ja"}, | |
{"english": "korean", "native": "Hangugeo", "flag": "🇰🇷", "code": "ko"}, | |
{"english": "german", "native": "Deutsch", "flag": "🇩🇪", "code": "de"}, | |
{"english": "dutch", "native": "Nederlands", "flag": "🇳🇱", "code": "nl"}, | |
{"english": "portuguese", "native": "Portugues", "flag": "🇵🇹🇧🇷", "code": "pt"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const finishJson5 = (unfinishedJson5: string) => { | |
let stack = []; | |
let inDoubleQuotes = false; | |
let inSingleQuotes = false; | |
let inSingleLineComment = false; | |
for (let i = 0; i < unfinishedJson5.length; i++) { | |
const currentChar = unfinishedJson5[i]; | |
const nextChar = unfinishedJson5[i + 1]; | |
let prevChar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Hide all notifications by default */ | |
[data-testid="notification"] { | |
display: none !important; | |
} | |
/* Show only notifications containing "liked your reply" or "replied" */ | |
[data-testid="notification"]:has(span:contains("liked your reply")), | |
[data-testid="notification"]:has(span:contains("replied")) { | |
display: block !important; | |
} |