Skip to content

Instantly share code, notes, and snippets.

View ckunte's full-sized avatar

Chetan Kunte ckunte

View GitHub Profile
@ckunte
ckunte / articles.php
Created April 2, 2015 00:52
Custom articles loop (for WordPress)
<?php
// Begin main loop to list page's static content
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2 class="post" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
</h2>
<?php the_content('Read on &#155;'); ?>
<?php endwhile; ?>
@ckunte
ckunte / searchform.php
Created April 2, 2015 00:53
Search form (for WordPress)
<form method="get" name="srch" action="<?php bloginfo('home'); ?>/">
<div style="margin:10px 0">
<label style="display:inline"><?php _e('Search &rsaquo; '); ?></label>
<input type="text" size="27" value="<?php the_search_query(); ?>" name="s" id="s" />
<input alt="" style="display:none" type="submit" value="search" />
</div>
</form>
@ckunte
ckunte / directsub2main.php
Created April 2, 2015 00:59
WordPress plugin: Subdomain to Domain redirect
<?php
/*
Plugin Name: Subdomain to Domain redirect
Plugin URI: https://gist.github.com/ckunte/8596c95e4a575477b971
Description: log subdomain address is redirected to root.
Author: Chyetanya Kunte (based on Matt Mullenweg's no-www plugin.)
Version: 1.0
Author URI: https://github.com/ckunte
*/
@ckunte
ckunte / linkroll.php
Created April 2, 2015 01:17
Linkroll (or blogroll) for WordPress: Generates a custom blogroll (for use with theme files).
<?php
/*
Template Name: Linkroll
*/
?>
<?php get_header(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
@ckunte
ckunte / pyli.tex
Created June 27, 2015 03:36
A simple LaTeX document template to list syntax highlighted python code (e.g., in Appendices, etc.)
%
% Highlighted code example in LaTeX
% ckunte on 2015-03-08.
%
\documentclass[11pt,a4paper]{article}
% Use utf-8 encoding for foreign characters
\usepackage[utf8]{inputenc}
% Setup for fullpage use
@ckunte
ckunte / met.py
Last active September 14, 2015 03:35
Finding stats for the available Metocean data. (Requires data file fields.py, not included in this gist.)
#!/usr/bin/env python
# encoding: utf-8
"""
met.py -- Finding stats for regions
2015-7-1: Created by ckunte.
2015-9-11: More dataset options added.
NOTE:
Two regional sets are available: sarawak, sabah
@ckunte
ckunte / getfilename.applescript
Created October 3, 2015 01:31
Get Filename (with any predefined path) -- I use for inserting images in posts
--- Get Filename (with any predefined path) -- I use for inserting images in posts
tell application "Finder" to get "/log/images/" & the name of (selection as alias)
@ckunte
ckunte / getfilenamefullpath.applescript
Created October 3, 2015 01:32
Get Filename with full path -- great for Terminal use
--- Get Filename with full path -- great for Terminal use
tell application "Finder" to return POSIX path of (parent of first item of (get selection as alias list) as alias) & name of (selection as alias)
@ckunte
ckunte / geturltitlefromsafari.applescript
Created October 3, 2015 01:33
Get URL and title from Safari's active tab -- useful for inserting hyperlinks
--- Get URL and title from Safari's active tab -- useful for inserting hyperlinks
tell application "Safari" to get the URL of the front document & " \"" & name of the front document & "\""
@ckunte
ckunte / gitbox.txt
Created October 17, 2015 12:37
If Gitbox crashes upon launch in OS X Mavericks, then run this at Terminal
defaults delete com.oleganza.gitbox