Skip to content

Instantly share code, notes, and snippets.

View tedkulp's full-sized avatar

Ted Kulp tedkulp

View GitHub Profile
<?php
class TestController extends SilkControllerBase
{
function test_action($params)
{
$this->set('test', 'Controller Works!');
}
function test_ajax($params)
As I've worked on CMSMS 2.0, I've run into a few recurring issues
that I didn't quite have an answer or reason for yet...
1. I wrote a lot of very generic pieces of code in order to make 2.0
easier to develop in the long run. I think I might've gone overboard
a bit. I wasn't ever sure why.
2. As a professional developer, I kept running into issues where I wanted
to use some of that code for other stuff. And it was too difficult to just
pull out the piece I needed and didn't do it.
<?php
class LoginController extends SilkControllerBase
{
function index($params)
{
$user_session = new SilkUserSession($params['login']);
if ($user_session->login())
{
//redirect('')
<?php
//Automatically add some component routes -- see docs for details
//SilkRoute::build_default_component_routes();
SilkRoute::register_route("/admin/:controller/:action/:id", array("component" => 'admin'));
SilkRoute::register_route("/admin/:controller/:action", array("id" => '', "component" => 'admin'));
SilkRoute::register_route("/admin/:controller", array("id" => '', 'action' => 'index', "component" => 'admin'));
//Catch-all goes here
<?php
//Automatically add some component routes -- see docs for details
//SilkRoute::build_default_component_routes();
SilkRoute::register_route("/admin/:controller/:action/:id", array("component" => 'admin'));
SilkRoute::register_route("/admin/:controller/:action", array("id" => '', "component" => 'admin'));
SilkRoute::register_route("/admin/:controller", array("id" => '', 'action' => 'index', "component" => 'admin'));
//Catch-all goes here
We couldn’t find that file to show.
{validation_errors for='template'}
{render_partial template='editform.tpl'}
#!/usr/bin/env ruby
#Creates projects from approved estimates in Freshbooks
#(c)2010 Ted Kulp ted@tedkulp.com
#Requires the tedkulp-freshbooks.rb gem
#To install:
# sudo gem install tedkulp-freshbooks.rb
#
#Create a ~/.freshbooks file (yaml format) with 'url' and 'key' keys
#to set the URL and API keys for freshbooks
#!/usr/bin/env ruby
#Script to import a large set of users from a CSV
#into CMSMS's FrontEndUsers module. Assumes the
#'cms_' database prefix.
require 'rubygems'
require 'faster_csv'
require 'pp'
require 'mysql'
class TestDataMapperTable extends CmsDataMapper
{
var $counter = 0;
static public $static_counter = 0;
var $_fields = array(
'id' => array(
'type' => 'int',
'primary' => true,
'serial' => true,