Skip to content

Instantly share code, notes, and snippets.

# Setup Memcache
['session', 'settings', 'view'].each do |option|
Ramaze::Cache.options.send(
option + '=',
Ramaze::Cache::MemCache.using(
:compression => false,
:username => ENV['MEMCACHE_USERNAME'],
:password => ENV['MEMCACHE_PASSWORD'],
:servers => ENV['MEMCACHE_SERVERS'].split(',')
)
# Memcache
memcache_options = {
:compression => false,
:username => ENV['MEMCACHE_USERNAME'],
:password => ENV['MEMCACHE_PASSWORD'],
:servers => ENV['MEMCACHE_SERVERS'].split(',')
}
Ramaze::Cache.options.session = Ramaze::Cache::MemCache
Ramaze::Cache.options.settings = Ramaze::Cache::MemCache
Ramaze::Cache.options.view = Ramaze::Cache::MemCache
<?php
/*
Plugin Name: Courseware Hacks
*/
function cw_hack_tabs() {
global $wp_filter;
foreach ( reset( $wp_filter['courseware_group_nav_options'] ) as $k => $v ){
$klass = reset( $v['function'] );
$method = end( $v['function'] );
require 'gettext/tools.rb'
require 'tenjin'
require 'ruby_parser'
require 'gettext_i18n_rails/ruby_gettext_extractor'
begin
require 'gettext/tools/rgettext'
rescue LoadError #version prior to 2.0
require 'gettext/rgettext'
@stas
stas / deps-manager.class
Created October 5, 2011 19:31
WordPress Plugins Dependency Manger
<?php
require_once ABSPATH . '/wp-admin/includes/file.php';
require_once ABSPATH . '/wp-admin/includes/plugin.php';
require_once ABSPATH . '/wp-admin/includes/plugin-install.php';
require_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
/**
* Main Deps Manager Class
*/
diff --git a/bp-core/admin/bp-core-admin.php b/bp-core/admin/bp-core-admin.php
index 4061f84..16ed27c 100644
--- bp-core/admin/bp-core-admin.php
+++ bp-core/admin/bp-core-admin.php
@@ -170,7 +170,10 @@ function bp_core_admin_component_setup_handler() {
// Settings form submitted, now save the settings. First, set active components
if ( isset( $_POST['bp_components'] ) ) {
+ require_once( BP_PLUGIN_DIR . '/bp-core/admin/bp-core-update.php' );
+ // Save settings and upgrade schema
@stas
stas / check_template.php
Created June 14, 2011 20:01
Checks if current theme has the template file for this post type
/**
* check_template()
*
* Checks if current theme has the template file for this post type
*/
function check_template() {
$template_name = 'single-event.php';
$source_template_file = dirname( __FILE__ ) .'/templates/' . $template_name;
$theme_folder = get_stylesheet_directory();
if( !file_exists( $theme_folder . '/' . $template_name ) )
@stas
stas / php5-fpm.vhost
Created May 4, 2011 00:03
nginx v.1.0 compatible vhost
server {
listen 80;
server_name courseware.nerd.ro;
access_log /var/log/nginx/localhost.access.log;
root /home/stas/Documente/www/cw/;
index index.php;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
@stas
stas / admin.js
Created March 10, 2011 10:48
WordPress pre-tinyMCE calls
edCanvas = $('body').find('textarea')[0];
$('a.thickbox').unbind();
@stas
stas / fprint.diff
Created March 2, 2011 22:28
FPrint Driver for OpenBravo POS
diff --git a/src-pos/com/openbravo/pos/config/JPanelConfigGeneral.java b/src-pos/com/openbravo/pos/config/JPanelConfigGeneral.java
--- a/src-pos/com/openbravo/pos/config/JPanelConfigGeneral.java
+++ b/src-pos/com/openbravo/pos/config/JPanelConfigGeneral.java
@@ -121,6 +121,7 @@
jcboMachinePrinter.addItem("ithaca");
jcboMachinePrinter.addItem("surepos");
jcboMachinePrinter.addItem("javapos");
+ jcboMachinePrinter.addItem("fprint");
jcboMachinePrinter.addItem("Not defined");