Skip to content

Instantly share code, notes, and snippets.

@hasssan
hasssan / php.snippets
Created July 12, 2011 10:32 — forked from aaroneaton/php.snippets
CodeIgniter PHP snippets for the VIM plugin SnipMate
# SnipMate is required to use snippets
# Download SnipMate: http://www.vim.org/scripts/script.php?script_id=2540
# Put this file in ~/.vim/snippets/ then restart vim
# This snippet file includes many useful snippets for CodeIgniter. Please feel free to fork and contribute!
snippet php
<?php
${1}
?>
snippet phpil
<?php ${1} ?>
@hasssan
hasssan / thematic-snippet.php
Created August 19, 2011 15:57
Wordpress Thematic Framework snippet
<?php
// I usually used this for developed wordpress theme at http://virtuemagz.com
// if don't like @import in stylesheet
function vmagz_create_stylesheet() {
$templatedir = get_bloginfo('template_directory');
$stylesheetdir = get_bloginfo('stylesheet_directory');
?>
<link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/reset.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/typography.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/images.css" />
@hasssan
hasssan / gist:2026925
Created March 13, 2012 05:03 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@hasssan
hasssan / robot.txt
Last active December 14, 2015 12:58
Wordpress: Robot.txt
User-agent: *
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/plugins/
Disallow: /wp-content/cache/
Disallow: /wp-content/themes/
@hasssan
hasssan / .htaccess
Last active December 14, 2015 12:58
Wordpress: .htaccess
<files wp-config.php>
order allow,deny
deny from all
</files>
# Block the include-only files.
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
@hasssan
hasssan / function.php
Created March 11, 2013 07:48
Wordpress: Function.php template for better security
<?php
// A major drawback of the current WordPress login form is
// that it informs the user which part of the login information he/she has gotten wrong.
// For instance, if the username is correct and the password wrong,
// WordPress informs the user about it. This makes it easier to use brute force login
// as the hacker has a clear idea of whether he/she needs to change the username or password.
// source: http://wp.tutsplus.com/tutorials/security/wordpress-security-threats-that-you-should-look-out-for/
function failed_login () {
# http://stackoverflow.com/questions/10314907/getting-a-list-of-files-in-sass-compass
require File.join(File.dirname(__FILE__), 'listfiles.rb')
@hasssan
hasssan / config.rb
Created March 12, 2013 09:15
Wordpress: Compass config.rb for theme development
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "."
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "javascripts"
environtment = :development
@hasssan
hasssan / gist:5432508
Created April 22, 2013 04:53
CSS: Hide text link
.logo {
background: url('images/logo.png') no-repeat transparent;
text-indent: -9999px;
overflow:hidden;
display: block;
position: relative;
}
@hasssan
hasssan / gist:7086099
Last active December 26, 2015 03:29
My Sublime Text 2 Settings
/**
* Sublime keymap by Hassan Aly (http://hassan.web.id)
* version 1.0
*/
[
// vim like normal mode command
{ "keys": ["n", "n"], "command": "advanced_new_file", "context": [{ "key": "setting.command_mode", "operand": true }]},
{ "keys": ["z", "a"], "command": "fold", "context": [{ "key": "setting.command_mode", "operand": true }]},
{ "keys": ["z", "i"], "command": "unfold", "context": [{ "key": "setting.command_mode", "operand": true }] },