Skip to content

Instantly share code, notes, and snippets.

View dragunoff's full-sized avatar

Ivaylo Draganov dragunoff

View GitHub Profile
@dragunoff
dragunoff / launch.json
Created June 6, 2020 20:45
OpenRA launch configurations for VSCode
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch (TD)",
"type": "mono",
"request": "launch",
"program": "${workspaceRoot}/OpenRA.Game.exe",
"cwd": "${workspaceRoot}",
"args": ["Game.Mod=cnc"]
@dragunoff
dragunoff / wp-trim-excerpt.php
Created December 12, 2012 08:02
[WP] Generate an excerpt from any text
<?php
/**
* Generate an excerpt from any text.
*
* @author Ivaylo Draganov <[email protected]>
* @note A modified version of core WP function wp_trim_excerpt
* @param (string) $text - The text to trim.
* @param (int) $words - The number of words to trim.
* @return (string) The trimmed and filtered excerpt.
*/
@dragunoff
dragunoff / functions.php
Last active October 7, 2015 14:38
[WP] Query posts and list them using a template
<?php
/*
Plugin Name: The Loop
Plugin URI: https://gist.github.com/3180818
Description: Query posts and display them.
Version: 0.2
Author: Ivaylo Draganov
Author URI: http://druuf.com/
*/
@dragunoff
dragunoff / wp-login-tweaks.php
Created June 20, 2012 10:18
Wordpress wp-login.php tweaks
<?php
/**
* Login logo link and title
*/
add_filter( 'login_headerurl', 'custom_login_headerurl' );
function custom_login_headerurl() { return get_home_url(); }
add_filter( 'login_headertitle', 'custom_login_headertitle' );
function custom_login_headertitle() { return get_bloginfo( 'description' ); }
@dragunoff
dragunoff / jquery.labetofield.js
Created January 30, 2012 16:55
[JS] Labels to text fields values
/*!
* Labels to text field values
* ===========================
*
* Set the default value of text fields to the text in a corresponding <label> element
*/
;(function($) {
$.fn.labelToValue = function() {
@dragunoff
dragunoff / extra-profile-fields-wp.php
Created January 29, 2012 00:51
[WP] Extra Profile Fields
<?php
/**
* Add additional custom fields to profile page
*/
add_action ( 'show_user_profile', 'wpq_show_extra_profile_fields' );
add_action ( 'edit_user_profile', 'wpq_show_extra_profile_fields' );
function wpq_show_extra_profile_fields ( $user ) {
?>
@dragunoff
dragunoff / simple-password-lockdown-wp.php
Created January 27, 2012 08:13
[WP] Block site from non-logged in users
<?php
/**
* Plugin name: Simple Password lockdown
* Plugin URI: https://gist.github.com/1687747
* Description: Block site from non-logged in users
*/
add_action('get_header', 'wpq_member_only_site');
function wpq_member_only_site() {