Skip to content

Instantly share code, notes, and snippets.

View hitautodestruct's full-sized avatar

Yotam hitautodestruct

View GitHub Profile
<ul>
<?php if(have_posts()): while(have_posts()): the_post();
?><li><?php the_title(); ?></li><?php
endwhile; endif; ?>
</ul>
@hitautodestruct
hitautodestruct / wp-ajax-request.php
Last active August 29, 2015 13:56
Backend ajax functionality in wordpress
<?php
function request_post(){
$nonce = $_POST['nonce'];
// check to see if the submitted nonce matches with the
// generated nonce we created earlier
if ( ! wp_verify_nonce( $nonce, 'my-nonce' ) )
die ( 'Please dont');
@hitautodestruct
hitautodestruct / sublime-text-2.json
Last active August 29, 2015 13:56
Default sublime text 2 settings
{
"font_size": 11.0,
"ignored_packages": [ "Vintage" ],
"auto_complete": true,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages": [],
"line_padding_bottom": 1,
"line_padding_top": 1,
"overlay_scroll_bars": "enabled",
@hitautodestruct
hitautodestruct / micro-clearfix.css
Created February 15, 2014 15:03
Micro clear fix hack for floated content
/**
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* contenteditable attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that are clearfixed.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
.cf:before,
@hitautodestruct
hitautodestruct / .htaccess
Created February 25, 2014 13:26
Wordpress htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@hitautodestruct
hitautodestruct / related.html
Last active August 29, 2015 14:01
Gets the related youtube videos based on the inputted id.
@hitautodestruct
hitautodestruct / httpd-vhosts.conf
Created September 17, 2014 12:27
Apache virtual hosts config for a local site
<VirtualHost dev.mysite.co.il:80>
ServerAdmin webmaster@localhost
DocumentRoot C:/my-site
ServerName dev.mysite.co.il
<Directory "C:/my-site">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
@hitautodestruct
hitautodestruct / preloader.js
Created November 11, 2014 12:34
A javascript image preloader. Accepts an array of image paths and then initiates a callback when done loading.
// Accepts array of image paths relative to the current page.
var preLoadImages = function( srcs, callback ) {
if ( srcs.length ) {
var cache = [],
args_len = srcs.length;
for (var i = args_len; i--;) {
@hitautodestruct
hitautodestruct / regex-explanation.md
Last active August 29, 2015 14:14
Great explanation of Regex taken from this site http://webcheatsheet.com/php/regular_expressions.php

Using Regular Expressions with PHP

Regular expressions are a powerful tool for examining and modifying text. Regular expressions themselves, with a general pattern notation almost like a mini programming language, allow you to describe and parse text. They enable you to search for patterns within a string, extracting matches flexibly and precisely. However, you should note that because regular expressions are more powerful, they are also slower than the more basic string functions. You should only use regular expressions if you have a particular need.

This tutorial gives a brief overview of basic regular expression syntax and then considers the functions that PHP provides for working with regular expressions.

The Basics Matching Patterns Replacing Patterns Array Processing

@hitautodestruct
hitautodestruct / SassMeister-input.sass
Created March 10, 2015 11:49
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
=language
$language: "Greek"
.Greek &
@content