Skip to content

Instantly share code, notes, and snippets.

View mente's full-sized avatar

Alex Vasilenko mente

View GitHub Profile
<?php
$pdo = new PDO('mysql:host=127.0.0.1;dbname=baikal', 'root', '');
$stmt = $pdo->query('SELECT created_date FROM carts_articles');
if (!$stmt->execute()) {
die("Unable to complete statement");
}
foreach ($stmt->fetchAll() as $row) {
var_dump($row[0]);
}
string(19) "2011-09-14 18:14:44"
string(19) "2011-09-14 18:39:42"
string(19) "2011-09-14 18:39:43"
string(19) "2011-09-14 18:39:43"
string(19) "2011-09-14 18:41:11"
string(19) "2011-09-14 18:41:13"
string(19) "2011-09-16 16:51:40"
string(19) "2011-09-16 16:51:42"
string(19) "2011-09-20 12:45:11"
string(19) "2011-09-20 12:45:12"
<bean id="searchNode" class="org.example.factory.ElasticSearchNodeFactoryBean"
p:configLocation="${elasticsearch.configLocation}">
<property name="settings">
<util:map>
<entry key="node.client" value="true" />
</util:map>
</property>
</bean>
<bean id="searchClient" factory-bean="searchNode" factory-method="client" />
@mente
mente / engage_init.js
Created November 17, 2011 15:05
janrain login error
<script type="text/javascript">
(function() {
if (typeof window.janrain !== 'object') window.janrain = {};
window.janrain.settings = {};
janrain.settings.tokenUrl = '${tokenUrl}';
function isReady() { janrain.ready = true; };
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", isReady, false);
@mente
mente / content.json
Created November 29, 2011 10:49
query_all with hyphens
{
...
"address": "9 Rue Saint - Hubert, Laval, QC H7G 2X7, Canada"
...
}
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean" securityManager-ref="webSecurityManager" loginUrl="/login" successUrl="/accounts/profile">
<property name="filterChainDefinitionMap">
<map>
<entry key="/accounts/**" value="passThru"/>
<entry key="/login" value="passThru"/>
<entry key="/admin/**" value="passThru, roles[ADMIN]"/>
</map>
</property>
</bean>
--- a/server/modules/http-plugin/web/js/cloud-carousel.1.0.5.js
+++ b/server/modules/http-plugin/web/js/cloud-carousel.1.0.5.js
@@ -209,6 +207,9 @@
this.rotate = function(direction)
{
this.frontIndex -= direction;
+ if (this.frontIndex < 0) {
+ this.frontIndex = items.length - 1;
+ }
this.frontIndex %= items.length;
diff --git a/cloud-carousel.1.0.5.js b/cloud-carousel.1.0.5.js
index b6fc6a9..2e7bdf6 100644
--- a/cloud-carousel.1.0.5.js
+++ b/cloud-carousel.1.0.5.js
@@ -147,19 +147,22 @@
clearTimeout(event.data.showFrontTextTimer);
$(options.altBox).html( ($(event.target).attr('alt') ));
$(options.titleBox).html( ($(event.target).attr('title') ));
- if ( options.bringToFront && event.type == 'click' )
- {
@mente
mente / gist:2585300
Created May 3, 2012 12:22
Elasticsearch nested type update
Works:
{
"script": "ctx._source.comments = comments",
"params": {
"comments": [{
"id": 123,
"body": "boom"
}]
}
}
Started GET "/streams/50155c10bb705c5375000007-web-errors/messages" for 192.168.1.101 at Mon Jul 30 06:06:06 -0400 2012
Processing by MessagesController#index as HTML
Parameters: {"stream_id"=>"50155c10bb705c5375000007-web-errors"}
Completed 500 Internal Server Error in 41ms
ArgumentError (symbol string may not contain `\0'):
tire (0.3.12) lib/tire/results/item.rb:18:in `to_sym'
tire (0.3.12) lib/tire/results/item.rb:18:in `initialize'
tire (0.3.12) lib/tire/results/item.rb:14:in `each_pair'
tire (0.3.12) lib/tire/results/item.rb:14:in `initialize'