Skip to content

Instantly share code, notes, and snippets.

@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@minhnc
minhnc / app.js
Created April 8, 2012 00:21
Remove All EventListeners
var win = Ti.UI.createWindow();
win.open();
/// <<< Register & UnRegister Event Listeners
/**
* params: {event: 'event', callback: eventCallback}
*/
function registerEventListener(obj, params) {
if ( typeof obj._eventListeners == 'undefined' ) {
@taterbase
taterbase / upload.php
Created May 13, 2012 15:03
Simple file upload in php
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
@adrianthedev
adrianthedev / gist:2842300
Created May 31, 2012 09:49
Search multidimensional arrays PHP
function search($array, $key, $value)
{
$results = array();
if (is_array($array))
{
if (isset($array[$key]) && $array[$key] == $value)
$results[] = $array;
foreach ($array as $subarray)
@nyamsprod
nyamsprod / dabblet.css
Created January 5, 2013 14:38
The Kitt Effect using Efficient CSS Animation
/**
* The Kitt Effect using Efficient CSS Animation
*/
html, body {
font:normal 100%/1.5 sans-serif;
}
.kitt,
.kitt div,
@bartholomej
bartholomej / css-media-queries-cheat-sheet.css
Last active July 23, 2024 12:17
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@cirocosta
cirocosta / iframe.html
Last active January 6, 2024 23:02
Sending messages from child iframe to parent webpage
<!DOCTYPE html>
<html>
<head>
<title>My Iframe</title>
</head>
<body>
<button>Botão</button>
<script type="text/javascript">
@pansapiens
pansapiens / standalone_html.py
Last active July 9, 2024 10:13
Convert HTML to a self contained file with inline Base64 encoded PNG images
#!/usr/bin/env python
# A simple script to suck up HTML, convert any images to inline Base64
# encoded format and write out the converted file.
#
# Usage: python standalone_html.py <input_file.html> <output_file.html>
#
# TODO: Consider MHTML format: https://en.wikipedia.org/wiki/MHTML
import os
from bs4 import BeautifulSoup
@rveitch
rveitch / next_prev_post.php
Last active December 5, 2023 20:04
Get next and prev posts in Wordpress by alphabetical order.
<?PHP
/*
* Sort Next/Previous Post Link Buttons Alphabetically
*/
function filter_next_post_sort($sort) {
if (get_post_type($post) == 'portfolio_page') {
$sort = "ORDER BY p.post_title ASC LIMIT 1";
}
else{
$sort = "ORDER BY p.post_date ASC LIMIT 1";
@ichigo92
ichigo92 / crawler.php
Last active March 17, 2023 05:58
PHP Crawler using CURL
<?php
//url
$redirect = "http://www.eyeofriyadh.com/events/";
$event = getEvents($redirect);
echo "Dates are : <br>" . $event;