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
const puppeteer = require('puppeteer-core'); | |
const cheerio = require('cheerio'); | |
const chrome = require('chrome-aws-lambda'); | |
export default async (req, res) => { | |
const slug = req?.query?.slug; | |
if (!slug) { | |
res.statusCode = 200 | |
res.setHeader('Content-Type', 'application/json') | |
res.end(JSON.stringify({ id: null })) |
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
/** | |
* @Post("/magic_link_signup") | |
*/ | |
function magicLinkSignUp($request) { | |
// get the query parameters from the post request | |
$queryParams = $request->query()->all(); | |
// get the token from queryParams | |
// this $token is the same $randomString that was | |
// generated in Step 1 |
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
/** | |
* pass mobile number of the user for whom | |
* you want to create an authenticated link, | |
* this mobile number may/may not be in your | |
* user's database | |
*/ | |
function createMagicLink($mobileNumber, $targetScreenUrl) { | |
// generate a random string of length 8 | |
$randomString = generateRandomString(8); | |
$maskedRandomString = generateMaskedRandomString($randomString); |
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 { useEffect, useRef, useState } from 'react'; | |
import firebase from 'firebase/app'; | |
import equal from 'deep-equal'; | |
function filterKeys(raw, allowed) { | |
if (!raw) { | |
return raw; | |
} | |
const s = new Set(allowed); | |
return Object.keys(raw) |
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
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<style> | |
.square, | |
.landscape { visibility: hidden; } | |
.portrait { visibility: visible; } | |
@media (min-aspect-ratio: 1/1) { | |
.portrait, | |
.landscape { visibility: hidden; } | |
.square { visibility: visible; } |
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 | |
############################################################### | |
# cPanel Subdomains Creator 1.1 | |
############################################################### | |
# Visit http://www.zubrag.com/scripts/ for updates | |
############################################################### | |
# | |
# Can be used in 3 ways: | |
# 1. just open script in browser and fill the form |
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
# fps=10 | |
ffmpeg -i video.mp4 -f image2 -vf fps=fps=10 img%03d.jpg | |
# vertical sprite | |
files=$(ls img*.jpg | sort -t '-' -n -k 2 | tr '\n' ' ') | |
convert $files -append output.jpg | |
# references: | |
# http://www.imagemagick.org/script/command-line-options.php#append | |
# http://www.imagemagick.org/script/command-line-options.php#resize |
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
background: linear-gradient(1deg, #a24bcf, #cf4b4b, #c0cf4b, #52cf4b, #52cf4b, #4bc5cf, #4b79cf); | |
background-size: 1400% 1400%; | |
-webkit-animation: encounterGradient 30s ease infinite; | |
-moz-animation: encounterGradient 30s ease infinite; | |
-o-animation: encounterGradient 30s ease infinite; | |
animation: encounterGradient 30s ease infinite; | |
@-webkit-keyframes encounterGradient { | |
0%{background-position:50% 0%} | |
50%{background-position:51% 100%} | |
100%{background-position:50% 0%} |
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
/* | |
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/ | |
* Better handling of scripts without supplied ids. | |
* | |
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function. | |
*/ | |
(function(doc, script) { | |
var js, | |
fjs = doc.getElementsByTagName(script)[0], |