Skip to content

Instantly share code, notes, and snippets.

View sglazov's full-sized avatar

Sergey Glazov sglazov

View GitHub Profile
@gokulkrishh
gokulkrishh / media-query.css
Last active April 22, 2025 04:29
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@mattclements
mattclements / function.php
Last active October 29, 2024 22:04
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@kovshenin
kovshenin / subscribers-count.php
Created November 19, 2015 13:03
Get subscribers count via the MailChimp API.
<?php
/**
* Get subscribers count via the MailChimp API.
*/
function mailchimp_get_subscribers_count() {
$cache_key = 'mailchimp-subscribers';
$api_key = '';
$username = '';
$dc = '';
$list_id = '';
@sxidsvit
sxidsvit / wp_gist_code_samples
Last active November 6, 2018 20:49
фрагменты кода для создания и настройки темы, включая вывод постов, сайдбаров и т.д
// ----------------------- style.css ------ создаем новую тему ---------------//
/*
Theme Name: MyTheme
*/
// ----------------------- functions.php -------------------------------------//
@lopspower
lopspower / README.md
Last active April 30, 2025 07:12
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@jarektkaczyk
jarektkaczyk / github-stars-oneline.php
Last active December 13, 2019 22:25
PHP 'One-liner' to get Github stargazers count for a user
<?php
// Not exactly one-liner but.. ;)
// --------------------
// require:
// illuminate/support
// guzzlehttp/guzzle
$user = 'jarektkaczyk';
$stars = collect(json_decode((new Guzzlehttp\Client)->get("https://api.github.com/users/{$user}/repos")->getBody(), true))
@jherax
jherax / is-private-mode.js
Last active February 14, 2025 11:03
Detect if the browser is running in Private mode - Promise based (last update: Feb 2020)
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise<boolean>}
*
* Live demo:
* @see https://output.jsbin.com/tazuwif
*
* This snippet uses Promises. If you want to run it in old browsers, polyfill it:
* @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js
*
@rchrd2
rchrd2 / test-php-basic-auth.php
Last active March 16, 2025 12:38 — forked from westonruter/test-php-basic-auth.php
PHP basic auth example
<?php
function require_auth() {
$AUTH_USER = 'admin';
$AUTH_PASS = 'admin';
header('Cache-Control: no-cache, must-revalidate, max-age=0');
$has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW']));
$is_not_authenticated = (
!$has_supplied_credentials ||
$_SERVER['PHP_AUTH_USER'] != $AUTH_USER ||
$_SERVER['PHP_AUTH_PW'] != $AUTH_PASS
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 25, 2025 17:14
Hyperlinks in Terminal Emulators
@63phc
63phc / node for timeweb
Created May 24, 2017 04:40
node for timeweb
Вы можете использовать node.js приложения через SSH-консоль. Для этого необходимо выполнить следующие действия:
На сайте Node.js в разделе Downloads https://nodejs.org/en/download/ выбрать"Linux Binaries" и скопировать ссылку на x64 версию. Пример ссылки на дистрибутив: https://nodejs.org/dist/v6.3.1/node-v6.3.1-linux-x64.tar.gz. Если ссылка заканчивается расширением xz, необходимо заменить его на gz.
Скачать и распаковать дистрибутив:
wget https://nodejs.org/dist/v6.3.1/node-v6.3.1-linux-x64.tar.gz
tar xf node-v6.3.1-linux-x64.tar.gz