Skip to content

Instantly share code, notes, and snippets.

View elvismdev's full-sized avatar
🏴

Elvis Morales elvismdev

🏴
View GitHub Profile
// http://aboutcode.net/2010/11/11/list-github-projects-using-javascript.html
jQuery.githubUser = function(username, callback) {
jQuery.getJSON("http://github.com/api/v1/json/" + username + "?callback=?", callback);
}
jQuery.fn.loadRepositores = function(username) {
this.html("<span>Querying GitHub for repositories...</span>");
var target = this;
@hakre
hakre / block-category-delete-example.php
Created November 23, 2010 14:56
Wordpress Block Category Delete Example
<?php
/**
* Block deletion of certain categories by their ID.
*
* Copyright (C) 2010 hakre <http://hakre.wordpress.com/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
@jasonbouffard
jasonbouffard / DateTimeTimeZone.php
Created June 16, 2011 16:46
Timezone on User Document in UserBundle Twig Extension
<?php
// Acme/DemoBundle/Twig/Extension/DateTimeTimeZone.php
namespace Acme\DemoBundle\Twig\Extension;
use Symfony\Component\Security\Core\SecurityContext;
use Acme\DemoBundle\Document\User as User;
class DateTimeTimeZone extends \Twig_Extension
@boxers999
boxers999 / gist:1216045
Created September 14, 2011 07:38
PHP SplObserver Example
<?php
class DemoSubject implements SplSubject{
private $observer, $value;
public function __construct(){
$this->observers = array();
}
@mjangda
mjangda / domain-whitelist-check.php
Created January 17, 2012 00:27
Checks if a given url matches a domain whitelist
<?php
function my_is_valid_domain( $url ) {
$whitelisted_domains = array( 'mydomain.com', 'mydomain.net' );
$domain = parse_url( $url, PHP_URL_HOST );
// Check if we match the domain exactly
if ( in_array( $domain, $whitelisted_domains ) )
return true;
$valid = false;
@cballou
cballou / youtube-vimeo-embed-urls.php
Created March 27, 2012 15:52
PHP Function to Convert Youtube and Vimeo URLs to Lightbox-Ready Equivalents
<?php
/**
* Given a string containing any combination of YouTube and Vimeo video URLs in
* a variety of formats (iframe, shortened, etc), each separated by a line break,
* parse the video string and determine it's valid embeddable URL for usage in
* popular JavaScript lightbox plugins.
*
* In addition, this handler grabs both the maximize size and thumbnail versions
* of video images for your general consumption. In the case of Vimeo, you must
* have the ability to make remote calls using file_get_contents(), which may be
@imjjss
imjjss / gist:2837942
Created May 30, 2012 17:54
hide gallery settings
function hide_gallery_settings()
{
echo '<style type="text/css">#gallery-settings{display:none;}</style>';
}
@rkmaier
rkmaier / getStrpart.php
Created July 10, 2012 15:31
PHP:: Get part of String based on start and end pattern
<?php
function getStringpart($string,$startStr,$endStr)
{
$startpos=strpos($string,$startStr);
$endpos=strpos($string,$endStr,$startpos);
$endpos=$endpos-$startpos;
$string=substr($string,$startpos,$endpos);
return $string;
@aliciaduffy
aliciaduffy / gist:3362670
Last active May 12, 2022 03:49
WordPress / ADMIN / Remove meta boxes from post edit screen
<?php
add_action( 'add_meta_boxes', 'NAME_remove_meta_boxes', 100);
function NAME_remove_meta_boxes() {
remove_meta_box( 'trackbacksdiv', 'post', 'normal' ); // Trackbacks meta box
remove_meta_box( 'postcustom', 'post', 'normal' ); // Custom fields meta box
remove_meta_box( 'commentsdiv', 'post', 'normal' ); // Comments meta box
remove_meta_box( 'slugdiv', 'post', 'normal' ); // Slug meta box
remove_meta_box( 'authordiv', 'post', 'normal' ); // Author meta box
remove_meta_box( 'revisionsdiv', 'post', 'normal' ); // Revisions meta box
remove_meta_box( 'formatdiv', 'post', 'normal' ); // Post format meta box
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active April 17, 2024 12:35
Using Git with Subversion Mirroring for WordPress Plugin Development