Skip to content

Instantly share code, notes, and snippets.

View rdlmda's full-sized avatar

Rudá Almeida rdlmda

  • Federal University of Rio de Janeiro
  • Rio de Janeiro, Brazil
  • 07:00 (UTC -03:00)
View GitHub Profile
<?php
/*
Enviar e-mail para o administrador se houver posts para revisão
Dica do @GugaAlves: incluir link para a edição do post no admin, facilitando a vida do admin que receber este email.
Dica do Gustavo Bordoni (@webord): incluir na função o $post (objeto para WP_Query) para não ficar passando o $post_id a cada save.
Dica do Manoel Netto: Incluir a verificação "! wp_is_post_revision( $post )" para não enviar e-mail a cada auto save.
*/
// ==UserScript==
// @name MOUSTACHE CHAT
// @author Robert Lemon
// @version 0.1
// @namespace http://rlemon.com
// @description Makes the chat all moustachy
// @include http://chat.stackexchange.com/rooms/*
// @include http://chat.stackoverflow.com/rooms/*
// ==/UserScript==
@sl4m
sl4m / gist:5091803
Created March 5, 2013 16:57 — forked from trcarden/gist:3295935
create self-signed certificate for localhost
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
anonymous
anonymous / usrbinwgetpaste.txt
Created April 2, 2013 18:43
/usr/bin/wgetpaste
#!/usr/bin/env bash
# A Script that automates pasting to a number of pastebin services
# relying only on bash, sed, coreutils (mktemp/sort/tr/wc/whoami/tee) and wget
# Copyright (c) 2007-2009 Bo Ørsted Andresen <[email protected]>
# Distributed in the public domain. Do with it whatever you want.
VERSION="2.20"
# don't inherit LANGUAGE from the env
unset LANGUAGE
@bordoni
bordoni / wp-config-security.php
Created June 25, 2013 15:47
Some definitions for security on WordPress
<?php
/**
* WordPress Files Edition Security
* Nobody can be able to edit files within the admin it self
*/
define( 'DISALLOW_FILE_EDIT', true );
define( 'DISALLOW_FILE_MODS', true );
@sheedy
sheedy / style-guides.md
Last active December 25, 2015 11:09
A list of "living" Style Guides

Style Guides

Add any links you want in this to the comments and I'll add them.

Grunt/JS/Handlebars

Generates styleguides from Markdown comments in CSS, SASS and LESS files using Handlebars

Node/JS

@neverything
neverything / functions.php
Last active December 10, 2023 02:22
WordPress: pre_get_posts filter to display one post per category. Displays the latest sticky post and therefore excludes the category of the sticky post as we only want one post per category.
<?php
/**
* Main Query for the Front Page
*
* Display the latest post per category. The latest sticky post goes to the
* top. It's category is then excluded as we only want 1 post per category.
*
* @param object $query WP_Query
*/
function sh_pre_get_posts_front_page( $query ) {
@claudiosanches
claudiosanches / index.html
Last active December 27, 2015 11:29
Get feed with jQuery
<!DOCTYPE html>
<html>
<head>
<title>Feed</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<script>
jQuery(document).ready(function($) {
var url = 'http://claudiosmweb.com/feed/',
@claudiosanches
claudiosanches / functions.php
Last active March 8, 2017 16:26
WordPress - Last posts with ajax.
<?php
function cs_last_posts_json() {
$json = array();
$last_posts = get_posts( array(
'posts_per_page' => 5,
'post_type' => 'post'
) );
foreach ( $last_posts as $post ) {
@johnReeve
johnReeve / custom.php
Created December 4, 2013 18:08
How I do my WordPRess site specific configuration fields
<?php
/* setup custom general settings */
function ts_theme_settings () {
register_setting( 'general', 'homepage_slider_wide' );
add_settings_field(
'homepage_slider_wide',
'Homepage Slider (Wide)',
'homepage_slider_wide_callback',