Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Andrei Surdu awps

🎯
Focusing
View GitHub Profile
@khromov
khromov / functions.php
Last active Nov 12, 2018
Cache a slow WP_Query in WordPress
View functions.php
<?php
/**
* Function that gets recent posts
*/
function get_recent_posts() {
//No cache
if(!wp_cache_get('my_complex_query_result')) {
//This is the super slow query.
@timurcatakli
timurcatakli / webpack.config.js
Last active Jul 27, 2021
An Easy to Understand Webpack 4+ Configuration File with Comments
View webpack.config.js
const publicPath = 'public';
// Node os module
// The os module provides a number of operating system-related utility methods.
// It can be accessed using:
const os = require('os');
// Using a single monolithic configuration file impacts comprehension and
// removes any potential for reusability.
// As the needs of your project grow, you have to figure out the means to manage
// webpack configuration more effectively.
@nim4n136
nim4n136 / encryption_openssl_salt.php
Last active Feb 2, 2022
Encryption & Decryption salt in PHP with OpenSSL
View encryption_openssl_salt.php
<?php
function encrypt($data, $password){
$iv = substr(sha1(mt_rand()), 0, 16);
$password = sha1($password);
$salt = sha1(mt_rand());
$saltWithPassword = hash('sha256', $password.$salt);
$encrypted = openssl_encrypt(
@kelvinmo
kelvinmo / s3link-v4.php
Created Oct 25, 2014
PHP code to generate a pre-signed URL to access a restricted AWS S3 object
View s3link-v4.php
@eduwass
eduwass / docker-compose.yml
Last active May 26, 2022
Mailhog + WordPress in docker-compose.yml
View docker-compose.yml
version: '3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
@winuxue
winuxue / puppeteer-ubuntu-1804.md
Created May 22, 2019
Solution for common dependences issues using puppeteer in ubuntu 18.04 (Bionic)
View puppeteer-ubuntu-1804.md

puppeteer dependeces in ubuntu 18.04 (Bionic)

error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

sudo apt-get install libnss3

error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

sudo apt-get install libxss1
@gordonbrander
gordonbrander / ID.js
Last active Jun 29, 2022
ID - a unique ID/name generator for JavaScript
View ID.js
// Do not use. Use Symbol() instead.