Skip to content

Instantly share code, notes, and snippets.

@code26
code26 / aliasWithParameter.md
Last active August 29, 2015 14:25
create an alias that accepts a parameter

Go to www directory with subdirectory option

wwwdir() { cd /var/www/$1 }

alias www=wwwdir

@code26
code26 / clone_parts.md
Last active August 29, 2015 14:25
Clone a specific folder

svn checkout https://github.com/foobar/Test/trunk/foo

where trunk = tree/master

@code26
code26 / eos_plymouth_fix.md
Last active August 29, 2015 14:25
[eOS] Plymouth fix for 1366 screens after updating to Nvidia proprietary driver

Plymouth

  1. Open /lib/plymouth/themes/elementary/elementary.script
  2. add aspectRatio = Window.GetWidth() / 1366;
  3. find logo.image = Image (logo_filename).Scale (logo.screen_size, logo.screen_size);
  4. change to logo.image = Image (logo_filename).Scale (logo.screen_size * aspectRatio, logo.screen_size);
  5. (also apply to logo_blurred)
  6. save
  7. sudo update-initramfs -u

Grub

@code26
code26 / jsp_switch_category_template.php
Last active August 29, 2015 14:06
Automatic template selector for Wordpress Child/Ancestor Categories
function jsp_switch_category_template() {
if (is_category()) {
$ancestors = get_ancestors(get_query_var('cat'),'category');
$catname = get_query_var('category_name');
if ($ancestors) {
$templatePath = TEMPLATEPATH . '/';
$prefix = 'category-'; //default page template prefix
$ext = '.php';
$appender = '_child';
$parent_id = $ancestors[0];
@code26
code26 / jsp_switch_page_template.php
Last active August 29, 2015 14:06
Automatic template selector for Wordpress Ancestor/Child Pages
function jsp_switch_page_template() {
global $post;
if (is_page() && !get_page_template_slug( $post->ID )) { //if no template was selected via WP
$ancestors = $post->ancestors;
if ($ancestors) {
$templatePath = TEMPLATEPATH . '/';
$prefix = 'page-'; //default page template prefix
$ext = '.php';