Skip to content

Instantly share code, notes, and snippets.

View motin's full-sized avatar

Motin motin

View GitHub Profile
@motin
motin / gist:4116696
Created November 20, 2012 08:16
_session - Name or password is incorrect
$ curl -XPUT -d '{
"_id": "org.couchdb.user:foobar1",
"name": "foobar1",
"type": "user",
"roles": [],
"password": "plaintext_password"
}' http://host:port/_users/org.couchdb.user:foobar1
{"ok":true,"id":"org.couchdb.user:foobar1","rev":"1-feed66a63c5cf324addc54b81314de34"}
> scons-1.2.0.bat -s debug=1 sdkinstaller run=1
...
runs fine for a while, until:
...
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be
removed in a future release
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be
removed in a future release
boot_win32.cpp
'rc' is not recognized as an internal or external command,
@motin
motin / SiteMap.php
Last active December 19, 2015 10:49
Helper files for a Yii module for app navigation
<?php
// components/SiteMap.php
class SiteMap
{
static private $uiModulePrefix = '/nav';
static public $map;
@motin
motin / diff
Created July 9, 2013 23:45
YiiBooster TbInputHorizontal vs TbInputVertical
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- vendor/clevertech/yiibooster/src/widgets/input/TbInputHorizontal.php
+++ vendor/clevertech/yiibooster/src/widgets/input/TbInputVertical.php
@@ -1,62 +1,33 @@
<?php
/**
- * TbInputHorizontal class file.
+ * TbInputVertical class file.
* @author Christoffer Niska <ChristofferNiska@gmail.com>
@motin
motin / example-code.php
Last active December 19, 2015 13:59
Custom row example code
<?php
// YiiBooster with pull #601
$input = $this->widget('P3MediaSelect', array('model' => $model, 'attribute' => 'original_media_id'), true);
echo $form->customRow($model, 'original_media_id', $input);
// YiiStrap
$input = $this->widget('P3MediaSelect', array('model' => $model, 'attribute' => 'original_media_id'), true);
echo TbHtml::customActiveControlGroup($input, $model, 'original_media_id');
<p> In addition to the default CRUD Generator provided by Gii, this Generator will:</p>
<h2>Default template</h2>
<ul>
<li> Obey model relations and render a appropriate DropDownList/CheckBox/ComboBox</li>
<li> Add Yii::t() for every string occuring so that your Application is easily being able to be translated to other languages </li>
<li> Add a Jui Datepicker Widget for date Fields </li>
<li> Add date() to timestamp, createtime and updatetime fields </li>
<li> Generate enum fields to a checkbox containing the possible values </li>
@motin
motin / CasperJS.php
Last active December 20, 2015 04:49
Preparation: Set the path to phantomjs and casperjs executables as Yii app params and then put the casperjs script(s) to run in a path specified by the alias root.casperjs. The casperjs script should be written to only output JSON.
<?php
class CasperJS
{
static public function request($script, stdClass $params = null)
{
if (is_null($params)) {
$params = new stdClass();
}
@motin
motin / giiscript.php
Created July 29, 2013 18:28
giiscript SiteController actions for some Gii automation. Not that necessary after https://github.com/schmunk42/gii-template-collection/commit/ad35929b5dcfbc49bf29b1a0d85c398bca24cf92 and the emergence of https://github.com/schmunk42/giic
<script>
function init$gii() {
window.giiwin = $('#gii')[0].contentWindow;
window.$gii = giiwin.$;
}
function s1() {
init$gii();
var model = $('select[name="model"]').val();
@motin
motin / phpjavabridge-apache-poi-example-code.php
Created July 30, 2013 18:49
Example code using the Java library Apache POI (http://php-java-bridge.sourceforge.net/pjb/webapp.php) to manipulate ppt-files (PHPPowerPoint can only create, not manipulate files). Uses Java/PHP bridge (http://php-java-bridge.sourceforge.net/pjb/how_it_works.php)
<?php
require_once("http://localhost:8080/GapcmsJavaBridge/java/Java.inc");
// fake paths for gist
$sourceDataPpt = APP_PATH . "/includes/source_data.ppt";
$uploadedPpt = APP_PATH . "/upload/foo_data.ppt";
try {
@motin
motin / starthq-test-code-and-mailchimp-listmembers-provider.js
Created October 17, 2013 17:16
StartHQ provider test code + mailchimp provider. Run this code in the developer tools console while logged in to your mailchimp account.
// include jquery - http://stackoverflow.com/questions/7474354/include-jquery-in-the-javascript-console
var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type:
jQuery.noConflict();
// define testing function
var testProvider = function (provider, term) {