Skip to content

Instantly share code, notes, and snippets.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Some basic stuff first
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.emacs.d/lisp")
(savehist-mode 1)
--- WEB-MODE DEBUG BEG ---
versions: emacs(24.3) web-mode("8.0.13")
vars: engine("php") content-type("html") file("/home/mantis/wa/test.php")
system: window(x) config("x86_64-pc-linux-gnu")
colors: fg(nil) bg(nil)
modes: whitespace-mode(nil) global-whitespace-mode(nil) rainbow-mode(nil) idle-highlight-mode(nil) fic-mode(nil)
(transient-mark-mode line-number-mode auto-compression-mode auto-encryption-mode auto-composition-mode blink-cursor-mode font-lock-mode global-font-lock-mode file-name-shadow-mode menu-bar-mode mouse-wheel-mode tooltip-mode savehist-mode recentf-mode sml-modeline-mode auto-complete-mode global-auto-complete-mode yas-minor-mode flymake-mode)
--- WEB-MODE DEBUG END --
<?php
get_header() ;
get_footer() ;
?>
@sunilw
sunilw / gist:9539401
Created March 13, 2014 23:35
wordpress ajax handler
<?php
/**
*
* Call functions from here
*
* Note: this file does not override the parent themes functions file.
* Instead, it gets loaded _before_ the parents functions.php gets loaded
*
*/
/*
@sunilw
sunilw / wordpress functions list
Created January 31, 2014 03:21
wordpress functions text list
get_adjacent_post
get_boundary_post
get_children
get_extended
get_next_post
get_next_posts_link
next_posts_link
get_permalink
the_permalink
get_the_excerpt
@sunilw
sunilw / gist:8696321
Created January 29, 2014 20:28
Wordpress: hides editor on a particular page. In this case, the options page
// hide editor on options page
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
if( !isset( $post_id ) ) return;
// Hide the editor on the page titled 'options'
$page_options = get_the_title($post_id);
if($page_options == 'options'){
@sunilw
sunilw / gist:8512400
Last active January 3, 2016 19:59
Tip Calculator, version 4
#!/usr/bin/python
from __future__ import division
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
"--mealcost",
type=float,
@sunilw
sunilw / gist:8469898
Last active January 3, 2016 13:29
Thinkful homework. Tax Calculator, version 3
#!/usr/bin/python
from __future__ import division
import sys
welcome = """
###################################
Meal Tip calculator
###################################
@sunilw
sunilw / gist:7146988
Created October 24, 2013 23:34
Wordpress get and formate post meta. Good for inspecting post meta.
<?php
// get post meta
$meta = get_post_meta( get_the_ID() );
echo "<pre>" ;
print_r($meta) ;
echo "</pre>" ;
?>
@sunilw
sunilw / gist:7098951
Last active December 26, 2015 05:09
working Gruntfile. Includes webserver. Watches for changes in filesystem. Runs compass, and produces sass debugging symbols.
module.exports = function (grunt){
grunt.initConfig({
compass : {
dist : {
options : {
sassDir : "sass",
cssDir : "css",
debugInfo : true