Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
WP_CONTENT="path to the wp-content directory of your install"
LANG_DIR=$WP_CONTENT/languages
TMP=$LANG_DIR/tmp
mkdir -p $TMP
/usr/bin/curl -s -o $TMP/bg_BG.po 'http://translate.wordpress.org/projects/wp/dev/bg/default/export-translations?format=po'
/usr/bin/curl -s -o $TMP/bg_BG.mo 'http://translate.wordpress.org/projects/wp/dev/bg/default/export-translations?format=mo'
@nb
nb / prio.php
Created November 27, 2013 16:01
<?php
add_filter( 'import_original_array', function( $args ) {
if ( isset( $args['references'] ) && preg_match( '|wp-content/themes/premium|', $args['references'] ) ) {
$args['priority'] = 'hidden';
}
return $args;
} );
@nb
nb / -
Created October 27, 2013 09:38
#!/bin/sh
LANG_DIR=/var/www/nb/nikolay.bg/bgbg/wp-content/languages
D=$LANG_DIR/tmp
/usr/bin/curl -s -o $D/bg_BG.po 'http://translate.wordpress.org/projects/wp/dev/bg/default/export-translations?format=po'
/usr/bin/curl -s -o $D/bg_BG.mo 'http://translate.wordpress.org/projects/wp/dev/bg/default/export-translations?format=mo'
/usr/bin/curl -s -o $D/admin-bg_BG.po 'http://translate.wordpress.org/projects/wp/dev/admin/bg/default/export-translations?format=po'
/usr/bin/curl -s -o $D/admin-bg_BG.mo 'http://translate.wordpress.org/projects/wp/dev/admin/bg/default/export-translations?format=mo'
@nb
nb / -
Created September 29, 2013 17:33
pbpaste| base64 -D > x.pdf
for i in `curl -s https://api.github.com/orgs/impromptu/repos | json -a name`; do hub clone Impromptu/$i; done
<?php
$pids = array();
for($i=0; $i<10; ++$i) {
$pid = pcntl_fork();
if ($pid) {
$pids[] = $pid;
} else {
sleep(2);
echo "Child " . posix_getpid() . " slept enough.\n";
@nb
nb / show_off.rb
Last active December 15, 2015 15:09
def twice(name, &blk)
yield 1, 2
yield [1, 2]
blk.call(1, 2)
end
a, b = 1, 2
10.times do
puts 'toshko'
@nb
nb / fork.c
Last active December 15, 2015 00:29
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
/* MB of memory to allocate */
#define MB 100
/* How many processes to spawn */
#define FORKS 50
/* How many random elements to change in the child process */
@nb
nb / composer.json
Last active December 14, 2015 03:49
{
"config" : {
"vendor-dir": "."
},
"require": {
"phpunit/phpunit": "*",
"squizlabs/php_codesniffer": "*",
"nb/oxymel": "dev-master"
}
}
<?php
public function notify_project_owner( $post_id ) {
if( 'project' == get_post_type() ) {
if( 'publish' == get_post_status( $post_id ) ) {
if( 'true' != get_post_meta( $post_id, 'project_owner_emailed', true ) ) {
$this->mailer->set_subject( __( 'Your Project Has Been Published!', 'cj' ) );
$this->mailer->set_message( __( 'Need filler text.', 'cj' ) );
$this->mailer->send_mail( $this->temp_email );