Skip to content

Instantly share code, notes, and snippets.

Avatar

Tobias Munk schmunk42

View GitHub Profile
@schmunk42
schmunk42 / autogenerate-packages.php
Created Oct 8, 2012
Test-script to auto-generate packages.json from github API
View autogenerate-packages.php
<?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) {
View gist:4349624
<?
/**
* 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 Apr 11, 2013
create composer.json files from github API
View GithubApiParser.php
<?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 Dec 16, 2015
Example how to customize Phundament Bootstrap Menu with P3Pages and custom database items.
View Helper.php
<?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
Phundament Packages
View gist:5522300
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
Custom Sidebar Menu with p3pages and yii-bootstrap
View SidebarMenu.php
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);
View mw-to-gollum.rb
#!/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")
View basecamp.php
<?
// 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/
View media-migration.php
<?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",
View gist:6106895
<?php
$tables = array(
'actor',
'address',
'category',
'film_text',
'inventory',
'language',
'payment',