Skip to content

Instantly share code, notes, and snippets.

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

Romans Malinovskis romaninsh

🚴‍♂️
Focusing
View GitHub Profile
RewriteEngine On
RewriteRule ^[^\.]*$ index.php [L]
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
<?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();
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
@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++
@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: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];
select SQL_CALC_FOUND_ROWS
`al_mo`.`id`,`al_mo`.`name`,`al_mo`.`created_dts`,`al_mo`.`deleted`,`al_mo`.`description`,
`al_mo`.`category_id`,
(select `al_ca`.`name` from `category` `al_ca` where `al_ca`.`deleted` = "N" and `al_mo`.`category_id` = `al_ca`.`id` ) `category`,
`al_mo`.`votes_support`,`al_mo`.`votes_abstain`,`al_mo`.`votes_oppose`, `al_mo`.`votes`,`al_mo`.`comments`,`al_mo`.`arguments`,
`al_mo`.`flags`,`al_mo`.`user_id`,
(select `al_us`.`name` from `user` `al_us` where `al_us`.`deleted` = "N" and `al_mo`.`user_id` = `al_us`.`id` ) `user_name`,
`al_mo`.`last_comment_dts`, `al_mo`.`last_vote_dts`,`al_mo`.`last_flag_dts`,`al_mo`.`last_argument_dts`,`al_mo`.`url`,
al_mo`.`is_hc`,`al_mo`.`motion_category_id`,`al_mo`.`video_id`,`al_mo`.`video_link`,`al_mo`.`tags`,
`al_mo`.`image_id`,
@romaninsh
romaninsh / Tabs.php
Created January 7, 2016 11:53
This is implementation of "Tabs" that also support icons in the tab
<?php
class Tabs extends View_Tabs_jUItabs {
function addTab($title,$name=null){
$container=$this->add('View_HtmlElement',$name);
$this->tab_template->set(array(
'url'=>'#'.$container->name,
'tab_id'=>$container->short_name,
@romaninsh
romaninsh / Model_File.php
Last active February 19, 2016 13:06
FileStore for ATK (version 2.0) draft - You will need https://github.com/blueimp/jQuery-File-Upload and tpyo/amazon-s3-php-class
<?php
class Model_File extends LF_Model {
public $table = 'file';
public $storage = null;
public $local_copy = null;
function init(){