Skip to content

Instantly share code, notes, and snippets.

View romaninsh's full-sized avatar
🚴‍♂️
Focusing

Romans Malinovskis romaninsh

🚴‍♂️
Focusing
View GitHub Profile
@romaninsh
romaninsh / gist:7217119
Created October 29, 2013 15:41
Implementation of Agile Slides: http://agiletech.ie/
<?php
class AgileSlides extends View {
/*
This class implements multiple slides and ajax buttons for next/prev
*/
public $step,$data;
function init(){
parent::init();
$this->step=$_GET[$this->name];
@romaninsh
romaninsh / gist:7006395
Created October 16, 2013 11:38
clang build
This file has been truncated, but you can view the full file.
Fat-Crow-4:Formula rw$ brew install -v -v -v mongodb
Warning: Your Xcode (5.0) is outdated
Please install Xcode 5.0.1.
==> Downloading http://downloads.mongodb.org/src/mongodb-src-r2.4.6.tar.gz
Already downloaded: /Library/Caches/Homebrew/mongodb-2.4.6.tar.gz
tar xf /Library/Caches/Homebrew/mongodb-2.4.6.tar.gz
==> Downloading patches
/usr/bin/curl -f#LA Homebrew 0.9.5 (Ruby 1.8.7-358; Mac OS X 10.9) https://github.com/mongodb/mongo/commit/be4bc7.patch -o 000-homebrew.diff https://github.com/romaninsh/mongo/commit/11db5d2.patch -o 001-homebrew.diff https://github.com/romaninsh/mongo/commit/1425af7.patch -o 002-homebrew.diff
######################################################################## 100.0%
######################################################################## 100.0%
@romaninsh
romaninsh / gist:6997201
Created October 15, 2013 19:23
mongodb fails link after building it with -stdlib=libstdc++
This file has been truncated, but you can view the full file.
g++ -o build/darwin/64/mongo/client/gridfs.o -c -Wnon-virtual-dtor -Woverloaded-virtual -stdlib=libstdc++ -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -O3 -m64 -DBOOST_ALL_NO_LIB -D_SCONS -DMONGO_EXPOSE_MACROS -DSUPPORT_UTF8 -D_FILE_OFFSET_BITS=64 -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -Ibuild/darwin/64/third_party/libstemmer_c/include -Isrc/third_party/libstemmer_c/include -Ibuild/darwin/64/third_party/s2 -Isrc/third_party/s2 -Ibuild/darwin/64/third_party/boost -Isrc/third_party/boost -Ibuild/darwin/64/third_party/pcre-8.30 -Isrc/third_party/pcre-8.30 -Ibuild/darwin/64 -Isrc -Ibuild/darwin/64/mongo -Isrc/mongo -I/usr/64/include -Ibuild/darwin/64/third_party/s2 -Isrc/third_party/s2 -Ibuild/darwin/64/third_party/snappy -Isrc/third_party/snappy -Ibuild/darwin/64/third_party/v8/include -Isrc/third_party/v8/include src/mongo/client/gridfs.cpp
g++ -o build/darwin/64/mongo/db/db.o -c -Wnon-virtual-dtor -Woverloaded-virtual -stdlib=libstdc++
Fat-Crow-4:mongodb-src-r2.4.6 rw$ export CXXFLAGS="-ntosehusnatoehusantoehusnatohu"
Fat-Crow-4:mongodb-src-r2.4.6 rw$ python /usr/local/bin/scons install --prefix=/usr/local/Cellar/mongodb/2.4.6 -j8 --6
scons: Reading SConscript files ...
scons version: 2.3.0
python version: 2 7 5 'final' 0
Checking whether the C++ compiler works(cached) yes
Checking for C header file unistd.h... (cached) yes
Checking whether clock_gettime is declared... (cached) no
Checking for C++ header file execinfo.h... (cached) yes
Checking whether backtrace is declared... (cached) yes
<?php
// Add a player and link player's API with a button-click in PHP
$p=$this->add('View_VimeoPlayer');
$this->add('Button')->js('click', $p->vimeo()->api('play'));
class View_VimeoPlayer extends View {
function init(){
parent::init();
select `profile`.`id`,`profile`.`element_type`,`profile`.`element_class`,`profile`.`name`,`profile`.`created_by`,(select `user`.`name` from `user` where `user`.`is_deleted` = 0 and `profile`.`created_by` = `user`.`id` ) `created`,`profile`.`descr`,`profile`.`is_show`,`profile`.`created_dts`,(select count(*) from `follower` where `follower`.`element_id` = `profile`.`id` ) `followers`,`profile`.`category_id`,(select `category`.`name` from `category` where `profile`.`category_id` = `category`.`id` ) `category`,`profile`.`picture_id`,(select concat("/elexu/prototype/", `_f`.`dirname`, "/", `filestore_file`.`filename`) `url` from `filestore_file` left join `filestore_volume` as `_f` on `_f`.`id` = `filestore_file`.`filestore_volume_id` inner join `filestore_image` as `_f_3` on `_f_3`.`original_file_id` = `filestore_file`.`id` where `profile`.`picture_id` = `filestore_file`.`id` ) `picture`,(select (select concat("/elexu/prototype/", `_f`.`dirname`, "/", `filestore_file`.`filename`) `url` from `filestore_file` left
RewriteEngine On
RewriteRule ^[^\.]*$ index.php [L]
@romaninsh
romaninsh / View_CommentTree.php
Created April 8, 2013 11:05
Example of hierarchy add-on use in agile toolkit
<?php
class View_CommentTree extends hierarchy\View_Tree {
function init(){
parent::init();
$this->time_ctl=$this->add('Controller_RoundTiming');
}
function formatRow(){
$this->current_row['added']=$this->time_ctl->fancy_datetime($this->current_row['added']).' ago';
$this->current_row_html['descr']=nl2br($this->makeUrls($this->current_row['descr']));
$this->current_row_html['profile_link']=

Pattern Router

A typical Agile Toolkit application converts your URL into a page. For example /mysite/profile?id=123 normally could be implemented like this:

class page_profile extends Page {
     function init(){
         parent::init();
         $this->setModel('User')->load($_GET['id']);
     }

function defaultTemplate(){

Changes 4.2.3 to 4.2.4

Note: for diff see: https://github.com/atk4/atk4/compare/4.2.3...4.2.4

General:

  • Added PSR-2 compliance to many core files. Will continue to improve other classes too.
  • Added composer.json. Agile Toolkit can be installed through Composer now
  • when calling setController, second argument can specify name or default options
  • Security fixes in Logger