Skip to content

Instantly share code, notes, and snippets.

View frost0103q's full-sized avatar

Web DEV expert frost0103q

View GitHub Profile
@frost0103q
frost0103q / gobble-tier.php
Created October 28, 2022 18:32 — forked from alisonmf/gobble-tier.php
WordPress - Get child pages and grandchild page list. Get ancestor list when on grandchild page.
<?php
if(is_page())
{
//Assuming current working page is the parent
//
$the_parent_id = $post->ID;
//Otherwise get the greatest ancestor id
//
@frost0103q
frost0103q / iframe.html
Created October 19, 2022 14:52 — forked from cirocosta/iframe.html
Sending messages from child iframe to parent webpage
<!DOCTYPE html>
<html>
<head>
<title>My Iframe</title>
</head>
<body>
<button>Botão</button>
<script type="text/javascript">
@frost0103q
frost0103q / checksudoku.js
Created December 7, 2021 23:19 — forked from maxx1128/checksudoku.js
Check if you solved a Sudoku
const checkSudoku = board => {
const isSudokuArrayValid = (array) => {
const row = array.slice(0).sort().join(''),
passingRow = [1,2,3,4,5,6,7,8,9].join('');
return (row === passingRow);
};
const testRows = (board) => board.every(row => isSudokuArrayValid(row));
@frost0103q
frost0103q / react-phone-book.js
Created November 3, 2021 01:29 — forked from roshanlabh/react-phone-book.js
Coderbyte - React Phone Book [solution]
import React, { useState } from "react";
import ReactDOM from "react-dom";
const style = {
table: {
borderCollapse: "collapse",
},
tableCell: {
border: "1px solid gray",
margin: 0,
@frost0103q
frost0103q / fbUrlCheck.php
Created October 19, 2021 21:08 — forked from atomicpages/fbUrlCheck.php
A simple facebook URL checker RegEx for PHP or JavaScript
<?php
/**
* A simple regex to test whether or not a facebook url is valid. For basic usage, this will do the job.
* @see Test cases <http://ideone.com/ZMJp4f>
*/
$fbUrlCheck = '/^(https?:\/\/)?(www\.)?facebook.com\/[a-zA-Z0-9(\.\?)?]/';
$secondCheck = '/home((\/)?\.[a-zA-Z0-9])?/';
$validUrl = 'https://www.facebook.com/atomicpages/';
@frost0103q
frost0103q / country_currency_list.msql
Created July 21, 2021 23:21 — forked from Guley/country_currency_list.msql
country with currency html codes list mysql
INSERT INTO `country` (`id`,`country_name`,`code`,`currency_name`, `currency_symbol`, `currency_code`) VALUES
(1, 'Afghanistan', 'AF', '+93', 'Afghan afghani', '&#65;&#102;', 'AFN'),
(2, 'ÅLAND ISLANDS', 'AX', '+358', 'Euro', '&#8364;', 'EUR'),
(3, 'Albania', 'AL', '+355', 'Albanian lek', '&#76;&#101;&#107;', 'ALL'),
(4, 'Algeria', 'DZ', '+213', 'Algerian dinar', '&#1583;&#1580;', 'DZD'),
(5, 'American Samoa', 'AS', '+1684', 'US Dollar', '&#36;', 'USD'),
(6, 'Andorra', 'AD', '+376', 'Euro', '&#8364;', 'EUR'),
(7, 'Angola', 'AO', '+244', 'Angolan kwanza', '&#75;&#122;', 'AOA'),
(8, 'Anguilla', 'AI', '+1264', 'East Caribbean dolla', '&#36;', 'XCD'),
(9, 'Antarctica', 'AQ', '+672', 'No universal currency', '', ''),
@frost0103q
frost0103q / gist:fe8c02e0e8fc08c581d4e4bc371ae6fe
Created July 21, 2021 23:20 — forked from voskobovich/gist:43f851859c23a8261514
The list of countries with currency (ISO code and symbol) format in SQL.
DROP TABLE currency;
-- Create table variable
CREATE TABLE currency (
country VARCHAR(100),
currency VARCHAR(100),
code VARCHAR(100),
symbol VARCHAR(100)
);
@frost0103q
frost0103q / google_font_importer.php
Created July 13, 2021 14:13 — forked from PeterBooker/google_font_importer.php
Imports Google Webfonts and creates a Dropdown to select a font from.
<?php
/*
* Google Font Importer
*/
$fonts = "https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyCpfnm5kVng8hhP_jnAnnTXVP7MEUM89-k";
$fonts = file_get_contents($fonts, 0, null, null);
$fp = fopen('fonts.txt', 'w');
@frost0103q
frost0103q / coordinatestoname.js
Created July 6, 2021 10:03 — forked from AmirHossein/coordinatestoname.js
Get City and Country name by coordinates via Google Maps api
// Demo: http://jsfiddle.net/xuyp8qb5/
// Note: You need Google Map API Key to run demo; bit.ly/2pBgToW
var latlng;
latlng = new google.maps.LatLng(40.730885, -73.997383); // New York, US
//latlng = new google.maps.LatLng(37.990849233935194, 23.738339349999933); // Athens, GR
//latlng = new google.maps.LatLng(48.8567, 2.3508); // Paris, FR
//latlng = new google.maps.LatLng(47.98247572667902, -102.49018710000001); // New Town, US
//latlng = new google.maps.LatLng(35.44448406385493, 50.99001635390618); // Parand, Tehran, IR
//latlng = new google.maps.LatLng(34.66431108560504, 50.89113940078118); // Saveh, Markazi, IR
@frost0103q
frost0103q / wp-admin-modal-dialog.php
Created November 9, 2020 08:05 — forked from anttiviljami/wp-admin-modal-dialog.php
WordPress admin modal dialog example
<?php
// enqueue these scripts and styles before admin_head
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though...
wp_enqueue_style( 'wp-jquery-ui-dialog' );
?>
<!-- The modal / dialog box, hidden somewhere near the footer -->
<div id="my-dialog" class="hidden" style="max-width:800px">
<h3>Dialog content</h3>
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p>