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
/* eslint-disable import/no-duplicates */ | |
/* eslint-disable no-console */ | |
const publicVapidKey = import.meta.env.VITE_VID_PUBLIC | |
const isClient = (): boolean => Boolean(typeof window !== 'undefined' && 'serviceWorker' in navigator) | |
const unSubscribe = async() => { | |
if (isClient) { | |
const reg = await navigator.serviceWorker.register('worker.js', { scope: '/' }) | |
const subscription = await reg.pushManager.getSubscription() |
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
/* eslint-disable no-unused-vars */ | |
const AWS = require('aws-sdk'); | |
const client = new AWS.S3({ | |
accessKeyId: process.env.AWS_ACCESS_KEY_ID, | |
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, | |
apiVersion: '2006-03-01', | |
}); | |
exports.Images = class Images { | |
constructor(options, app) { | |
this.options = options || {}; |
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 { snakeToCamel, camelToSnake } = require ("waelio-utils"); | |
function regModule (mod ) { | |
if(!mod) return null | |
const modelName = mod.name | |
const UPPER = modelName.toUpperCase() | |
const SNAKE = camelToSnake(modelName) | |
const UPPER_SNAKE = SNAKE.toUpperCase() | |
const CAMEL = modelName.charAt(0).toUpperCase() + modelName.slice(1) | |
const isNameSpaced = mod.namespaced || false | |
try { |
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 | |
/** | |
* Created by PhpStorm. | |
* User: wahbehw | |
* Date: 2/1/2016 | |
* Time: 9:26 AM | |
*/ | |
//namespace entity_object; |
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 | |
$imgs = get_posts("post_type=attachment&numberposts=-1"); | |
$x=0; | |
foreach($imgs as $img){ | |
$file = get_attached_file($img->ID); | |
$Image_size = getimagesize($file); | |
if(!is_array($Image_size)){ | |
wp_delete_post( $img->ID, false ); | |
echo $x .'- Deleting attachment #'.$img->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 | |
/** | |
* replace array Values (string) with length values | |
* @param array $string | |
*/ | |
function get_string_length(&$string){ | |
if ((is_string($string)) || (is_integer($string))) | |
$string = strlen($string); | |
} |
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 | |
function generate_password($length = 64){ | |
$box_array = array( 'jhg','RTJ','ZCG','{;G','KRA','!','@','$','%','^','&','*','(',')','_','=','+' ); | |
$password=''; | |
for($x=0; $x < $length; $x++){ | |
$password .= $box_array[intval(array_rand($box_array))]; | |
} |
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 | |
function getConnection1(){ | |
$dbhost = "localhost"; | |
$dbuser = "test"; | |
$dbpass = "test"; | |
$dbname = "schema name"; | |
$dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'')); | |
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
return $dbh; | |
} |
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 | |
/** | |
* Get the HREF value of an IMG | |
* | |
* @param $g_ava | |
* | |
* @return mixed | |
*/ | |
function get_avatar_link($g_ava){ | |
if (is_string($g_ava)){ |
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 | |
/** | |
* Create an element | |
*/ | |
class Element | |
{ | |
private $type; | |
private $unaryTagArray = array('area','base','br','col','command','embed','hr','img','input','keygen','link','meta','param','source','track','wbr'); | |
private $attributes; | |
private $innerHtml; |
NewerOlder