Skip to content

Instantly share code, notes, and snippets.

@pasmat
pasmat / gist:60c555ea5d5d21409aad83540968831c
Created September 28, 2023 10:39
gpt formbuilder test
query:
you are an expert software developer
You are applying for a senior software developer job with high salary and you are highly incentivized to provide your best code
you are tasked to write the code for this in Next.js + Tailwind CSS
Take a deep breath and think step-by-step about how you will do this
In job interview, aiming to get the best quality code from you, you are tasked to create a form builder that first lets users create a form with multiple possible datatypes: text, numbers and yes/no
@pasmat
pasmat / gist:0447b146bbd41fde28cdf168b7b57779
Created September 28, 2023 10:33
gpt whiteboard test revised
query:
you are an expert software developer
You are applying for a senior software developer job with high salary and you are highly incentivized to provide your best code
you are tasked to write the code for this in Next.js + Tailwind CSS
Take a deep breath and think step-by-step about how you will do this
In job interview, aiming to get the best quality code from you, you are tasked to create the following screens
@pasmat
pasmat / gist:7c8a120bda276c8467bd10fe625ffa68
Created September 28, 2023 10:28
gpt4 whiteboard test
query:
you are an expert software developer
this was my teams whiteboarding session for our onboarding flow
you need to write the code for this in Next.js + Tailwind CSS
Take a deep breath and think step-by-step about how you will do this
Now write complete code for this working one step at a time.
@pasmat
pasmat / Email.kt
Created February 9, 2021 10:56
Open E-mail intent Android
fun tryVerifyMail() {
try {
val intents: List<Intent> = (packageManager.queryIntentActivities(Intent(
Intent.ACTION_SENDTO, Uri.fromParts(
"mailto", "lowhillgamesoy@gmail.com", null
)
), 0) + packageManager.queryIntentActivities(Intent(Intent.ACTION_VIEW).also {
it.type = "message/rfc822"
}, 0)).mapNotNull {
it.activityInfo.packageName
@pasmat
pasmat / manage_url_parameters.js
Created October 12, 2020 14:08
Functions to manage url parameters from JavaScript context
function parseUrlParameters(search) {
var queryParts = {};
var searchParts = search.split("&");
for (var i = 0; i < searchParts.length; i++) {
var searchPart = searchParts[i];
var whitespaceIndex = searchPart.indexOf("=");
@pasmat
pasmat / coordinates_by_country_code.json
Created July 13, 2020 13:17
Coordinates and name by country code - found all kind of formats, but not this particular.. Useful for quick lookups of coordinates by country code.
{"AD":{"lat":42.546245,"lng":1.601554,"name":"Andorra"},"AE":{"lat":23.424076,"lng":53.847818,"name":"United Arab Emirates"},"AF":{"lat":33.93911,"lng":67.709953,"name":"Afghanistan"},"AG":{"lat":17.060816,"lng":-61.796428,"name":"Antigua and Barbuda"},"AI":{"lat":18.220554,"lng":-63.068615,"name":"Anguilla"},"AL":{"lat":41.153332,"lng":20.168331,"name":"Albania"},"AM":{"lat":40.069099,"lng":45.038189,"name":"Armenia"},"AN":{"lat":12.226079,"lng":-69.060087,"name":"Netherlands Antilles"},"AO":{"lat":-11.202692,"lng":17.873887,"name":"Angola"},"AQ":{"lat":-75.250973,"lng":-0.071389,"name":"Antarctica"},"AR":{"lat":-38.416097,"lng":-63.616672,"name":"Argentina"},"AS":{"lat":-14.270972,"lng":-170.132217,"name":"American Samoa"},"AT":{"lat":47.516231,"lng":14.550072,"name":"Austria"},"AU":{"lat":-25.274398,"lng":133.775136,"name":"Australia"},"AW":{"lat":12.52111,"lng":-69.968338,"name":"Aruba"},"AZ":{"lat":40.143105,"lng":47.576927,"name":"Azerbaijan"},"BA":{"lat":43.915886,"lng":17.679076,"name":"Bosnia and Her
@pasmat
pasmat / js-css-circle-progress.html
Last active March 3, 2020 21:06
Circular progress using CSS and JS.
<html>
<body>
<style>
.root {
width: 50px;
height: 50px;
position: relative;
}
@pasmat
pasmat / pausePromise.js
Created January 31, 2020 12:33
a javascript function that returns a Promise which includes artificial latency of x seconds.
/*
used such as..
fetch("https://google.com")
.then(function (response) {
return pausePromise(response, 5)
})
.then(function (response) {
console.log(response);
@pasmat
pasmat / ISO639-2_to_date_format.json
Created January 30, 2020 17:05
Map of countries with their preferred date formats based on ISO629-2 country code adopted from https://gist.github.com/mlconnor/1887156
{
"AL": "yyyy-MM-dd",
"AE": "dd/MM/yyyy",
"AR": "dd/MM/yyyy",
"AU": "d/MM/yyyy",
"AT": "dd.MM.yyyy",
"BE": "d/MM/yyyy",
"BG": "yyyy-M-d",
"BH": "dd/MM/yyyy",
"BA": "yyyy-MM-dd",
@pasmat
pasmat / changeUrlParameters.js
Created November 30, 2019 10:54
An function to modify parameters within url, either to change them or replace them. Useful when updating url based on changes on page dynamically without a reload.
static function changeParameters($url, $parameters)
{
$urlParts = parse_url($url);
$url = "";
if (isset($urlParts['scheme'])) {
$url .= $urlParts['scheme'] . "://";
}