Skip to content

Instantly share code, notes, and snippets.

View SErr0r's full-sized avatar

Gennady Yudenko SErr0r

View GitHub Profile

Keybase proof

I hereby claim:

  • I am serr0r on github.
  • I am serr0r (https://keybase.io/serr0r) on keybase.
  • I have a public key ASC8JLfP1zoKxzj82_YjrOn6GjYPlQ4XK3BqiF-YC_ALago

To claim this, I am signing this object:

@SErr0r
SErr0r / function-admin.php
Last active March 31, 2018 08:57
Register WordPress Scripts
<?php
// Add custom JS script to WordPress admin.
function custom_scripts() {
wp_register_script( 'my-admin-script', 'http://example.com/custom.js', array( 'jquery' ), '1.0', true );
wp_enqueue_script( 'my-admin-script' );
}
// Hook into the 'admin_enqueue_scripts' action
@SErr0r
SErr0r / dabblet.css
Last active March 5, 2018 10:52
prism.js default theme for JavaScript, CSS and HTML * Based on dabblet (http://dabblet.com) * @author Lea Verou
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
background: none;
Verifying my Blockstack ID is secured with the address 1HTrF9RZWkk7WUimSuLBRBkW1MMQNYZpTG https://explorer.blockstack.org/address/1HTrF9RZWkk7WUimSuLBRBkW1MMQNYZpTG
@SErr0r
SErr0r / index.html
Created December 4, 2017 00:48
Window open() method opens a new browser window.
<script type="text/javascript">
function showImprint(){
var imprintwnd = window.open('','pcrew_imprint','width=640,height=480,left=200,top=200,menubar=no,status=yes,toolbar=no');
imprintwnd.document.writeln("");
imprintwnd.document.close();
}
function showPolicy(){
var link = 'www.parkingcrew.net';
policywnd = window.open(
'http://' + link + '/privacy.html','pcrew_policy','width=890,height=330,left=200,top=200,menubar=no,status=yes,toolbar=no');
Verifying that "serr0r.id" is my Blockstack ID. https://onename.com/serr0r
@SErr0r
SErr0r / function.php
Last active May 7, 2017 18:52
Adding a favicon to your site (including at the root)
<?php
function emw_add_favicon () {
echo '<link rel="shortcut icon" type="image/vnd.microsoft.icon" href="'.get_stylesheet_directory_uri().'/assets/images/favicon.ico">'."\r\n";
echo '<link rel="icon" type="image/vnd.microsoft.icon" href="'.get_stylesheet_directory_uri().'/assets/images/imgfavicon.ico">'."\r\n"; // Shouldn't be necessary, but added for maximum browser compatibility
}
add_action('wp_head', 'emw_add_favicon');
?>
@SErr0r
SErr0r / function.php
Created June 20, 2016 15:16
Русифицированная функция PHP strftime (русские названия месяцев)
<?php
function strftime_rus($format, $date = FALSE) {
// Работает точно так же, как и strftime(), только в строке формата может принимать дополнительный аргумент %B2, который будет заменен на русское название месяца в родительном падеже. %e - день месяца.
// http://webew.ru/posts/4024.webew
if (!$date)
$timestamp = time();
elseif (!is_numeric($date))
$timestamp = strtotime($date);
@SErr0r
SErr0r / index.php
Created June 20, 2016 15:14
Get attached file size
<?php
filesize( get_attached_file( $attachment->ID ) );
?>
@SErr0r
SErr0r / function.php
Created June 20, 2016 15:08
Get theme version
<?php
//* Get version of the current theme
//* @static
//* @return string
//* @access public
public static function getThemeVersion() {
$theme_data = wp_get_theme();
return $theme_data->Version;