Skip to content

Instantly share code, notes, and snippets.

View magl88's full-sized avatar
🏠
Working from home

Eugene Rudoi magl88

🏠
Working from home
View GitHub Profile
@DryaginMihael
DryaginMihael / jsInterviewTasks.js
Last active March 11, 2025 12:33
JS Interview task
// 1-я задача
function foo() {
const x = 10;
return {
x: 20,
bar: () => {
console.log(this.x);
},
baz: function () {
console.log(this.x);
@PlugFox
PlugFox / conditional_import.dart
Last active February 15, 2024 13:11
Firebase Remote Config - web implementation
/// Base interface
import 'remote_config_base.dart';
/// Conditional import
import 'remote_config_mobile.dart'
// ignore: uri_does_not_exist
if (dart.library.html) 'remote_config_web.dart';
...
final config = await getRemoteConfig();
@jjcodes78
jjcodes78 / nextjs-deploy.md
Last active October 4, 2025 17:38
Deploying NEXTJS site with nginx + pm2

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

@giovanni-d
giovanni-d / allinonemigration.md
Last active October 30, 2025 05:36
All-in-One WP Migration - Restore From Server (without PRO version) - Restore

All-in-One WP Migration Restore From Server (without pro version)

If you don't want to pay for the PRO version of this plugin, and you want to use the "Restore from Server" functionally that was present in the version 6.77, open your browser’s dev tools and run the code below in the console:

Last confirmed working: May 2025 on version 7.94

var filename = 'FILENAME.wpress';
@DvdGiessen
DvdGiessen / directadmin-dynamic-dns.sh
Created September 10, 2018 19:25
Simple dynamic DNS update script for a domain in DirectAdmin
#!/bin/bash
# Script for automatically updating the DNS records using the DirectAdmin API.
# Requires you to have curl, dig and json installed.
#
# By Daniël van de Giessen, 2018-09-10
# https://www.dvdgiessen.nl
# Configuration
DOMAINNAME="example.com"
@robbiegod
robbiegod / functions.php
Last active August 29, 2024 19:24
Wordpress Function: Loads a single-{cat->slug}.php by category slug or single-{post_type}.php custom template by post type. If these don't exist use single.php.
<?php
/**
* single-{category_slug}.php || single-post-type.php || single.php
*
* Gets post cat slug, post type and look matching single- templates.
* If $categories is not empty, get the category slug, and look for single-{$category_slug}.php. If this file doesn't exist then return single.php.
* If $categories is empty, then check the post_type. If its not equal to post, then we are using a custom post type. Look for
* single-{$post_type}.php. If this file doesn't exist then use single.php.
* If $categories is empty and post_type is equal to post then use single.php.
*
@zmts
zmts / tokens.md
Last active October 29, 2025 08:59
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@mattradford
mattradford / licence activation.php
Last active August 29, 2024 20:36
ACF5 Pro licence activation. Could be adapted for any other plugin that requires a licence key, but doesn't yet support defining it in wp-config. Fires on theme activation.
// Place this in wp-config
define( 'ACF_5_KEY', 'yourkeyhere' );
// Set ACF 5 license key on theme activation. Stick in your functions.php or equivalent.
function auto_set_license_keys() {
if ( ! get_option( 'acf_pro_license' ) && defined( 'ACF_5_KEY' ) ) {
$save = array(
'key' => ACF_5_KEY,
@DavidWells
DavidWells / reset.css
Last active October 15, 2025 10:08 — forked from karbassi/reset.css
CSS reset. Follow me on the twitters for more tips: https://twitter.com/davidwells
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@mikejolley
mikejolley / gist:1860056
Created February 18, 2012 16:27
WooCommerce - Override billing fields
add_filter( 'woocommerce_billing_fields', 'custom_woocommerce_billing_fields' );
function custom_woocommerce_billing_fields( $fields ) {
// Over-ride a single label
$fields['billing_first_name']['label'] = 'Your label';
// Over-ride a single required value
$fields['billing_first_name']['required'] = false;