Skip to content

Instantly share code, notes, and snippets.

View schmunk42's full-sized avatar

Tobias Munk schmunk42

View GitHub Profile
@schmunk42
schmunk42 / autogenerate-packages.php
Created October 8, 2012 16:27
Test-script to auto-generate packages.json from github API
<?php
// get all repos from yiiext
$response = file_get_contents("https://api.github.com/orgs/yiiext/repos");
$repos = json_decode($response);
#var_dump($repos);
// get versions/tags
$satis = array();
foreach($repos AS $num => $repo) {
@schmunk42
schmunk42 / gist:4349624
Created December 20, 2012 23:44
Updated Yii Metadata component from http://www.yiiframework.com/extension/metadata/
<?
/**
* Metadata Helps to get metadata about models,controllers and actions in application*
*
* For using you need:
* 1. Place this file to directory with components of your application (your_app_dir/protected/components)
* 2. Add it to 'components' in your application config (your_app_dir/protected/config/main.php)
* 'components'=>array(
* 'metadata'=>array('class'=>'Metadata'),
* ...
@schmunk42
schmunk42 / GithubApiParser.php
Created April 11, 2013 12:03
create composer.json files from github API
<?php
class GithubApiParser
{
public $accessToken = "1234abcd";
public function __construct($model)
{
$this->_url = substr(str_replace("https://github.com/", "https://api.github.com/repos/", $model->url), 0, -4);
@schmunk42
schmunk42 / Helper.php
Last active December 16, 2015 22:20
Example how to customize Phundament Bootstrap Menu with P3Pages and custom database items.
<?php
class Helper
{
static public function getMenuItems($rootNode = null)
{
if ($rootNode === null) {
$rootNode = P3Page::model()->findByAttributes(array('layout' => '_BootMenu'));
}
$items = P3Page::getMenuItems($rootNode);
@schmunk42
schmunk42 / gist:5522300
Created May 5, 2013 21:44
Phundament Packages
anggiaj/eselect2 dev-master
crisu83/yii-bootstrap 1.2.0
crisu83/yii-rights dev-tip
fortawesome/font-awesome v3.0.3
ifdattic/echosen dev-master
malyshev/yii-debug-toolbar dev-master
mishamx/yii-user dev-master
phundament/gii-template-collection 0.8.8
phundament/jquery-file-upload dev-master
phundament/p3admin 0.12.2
@schmunk42
schmunk42 / SidebarMenu.php
Created May 24, 2013 11:38
Custom Sidebar Menu with p3pages and yii-bootstrap
class SidebarMenu extends TbMenu {
public $rootNameId;
public $type = 'tabs';
public $stacked = 'true';
function init(){
parent::init();
$model = P3Page::model()->findByAttributes(array('nameId'=>$this->rootNameId));
$this->items = P3Page::getMenuItems($model);
#!/usr/bin/env ruby
require 'rubygems'
require 'hpricot'
require 'gollum'
require 'gollum-lib'
wiki = Gollum::Wiki.new('openaustralia.wiki')
file = File.open("OpenAustralia-20110309232515.xml", "r")
<?
// make sure the folder of the script is writeble (0777)
$basecampUrl = '[YOUR BASECAMP URL HERE]'; // e.g. https://stelabouras.basecamphq.com/ (Don't forget the trailing slash!)
$apiKey = '[YOUR API KEY HERE]'; // e.g. one huge string (found in 'My info' in the Authentication tokens section)
function BasecampCall($endPoint, $usePrefix = true) {
global $apiKey, $basecampUrl;
// From: http://prattski.com/2008/10/22/basecamp-api-examples-using-php-and-curl-get/
@schmunk42
schmunk42 / media-migration.php
Last active December 20, 2015 06:39
PhMedia Schema
<?php
$this->createTable(
"p3_media", array(
// media data
"id" => "pk",
"type" => "ENUM('file', 'directory') NOT NULL",
"nameId" => "varchar(32) NOT NULL",
"defaultTitle" => "varchar(128) NOT NULL",
<?php
$tables = array(
'actor',
'address',
'category',
'film_text',
'inventory',
'language',
'payment',