Skip to content

Instantly share code, notes, and snippets.

@augustine-tran
augustine-tran / Fixed TwitterProxy
Created December 7, 2010 13:53
replace arguments by hack to add empty params.filters to request for buildUrl
/**
* We need to add a little processing to the normal buildRequest. In YQL we send an SQL-like
* query statement - in this case using the search query above. To honor the filters applied
* by the user, we pull those out in this function and apply them to the search XTemplate.
* Finally, we modify the url to add this generated query and any other required parameters.
*/
buildRequest: function(operation) {
var hack = Ext.apply({params: {filters: []}}, arguments);
var request = Ext.data.KivaProxy.superclass.buildRequest.apply(this, [hack]),
queryTpl = this.queries.search,
@augustine-tran
augustine-tran / gist:2030155
Created March 13, 2012 17:43
Example for customized ExtJS picker that contains a form
Ext.define('Test', {
extend:'Ext.form.field.Picker',
alias: 'widget.test',
requires: ['Ext.form.field.Date', 'Ext.picker.Time', 'Ext.view.BoundListKeyNav', 'Ext.Date'],
alternateClassName: ['Test'],
/**
* @cfg {String} [triggerCls='x-form-time-trigger']
* An additional CSS class used to style the trigger button. The trigger will always get the {@link #triggerBaseCls}
* by default and triggerCls will be **appended** if specified.
DELETE
DELETE _template/{name}
DELETE {index}
DELETE {index}/_alias/{name}
DELETE {index}/_query
DELETE {index}/_warmer
DELETE {index}/_warmer/{name}
DELETE {index}/{type}
DELETE {index}/{type}/_mapping
DELETE {index}/{type}/_query
@augustine-tran
augustine-tran / #neo4j other movies of actors in LOTR
Created September 27, 2013 07:48
Get all other movies of each actors acted in "The Lord of ring: Two Towers"
start m=node:Movie(id="120")
match m<-[r:ACTS_IN]-(actor)-[role:ACTS_IN]->(movie)
return collect(movie.title + " : " + role.name), actor.name + " : " + r.name;
@augustine-tran
augustine-tran / javascript_resources.md
Created October 26, 2013 03:05 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@augustine-tran
augustine-tran / Glandore.model.js
Created October 26, 2013 03:07
Model Associations in Sencha Touch (and ExtJS) made easy! Porting from Sencha Touch to ExtJS
Ext.define('Glandore.model.Base', {
extend: 'Ext.data.Model',
idProperty: 'id',
isNew: function() {
return this.phantom == true;
},
linkedAssociations: false,
@augustine-tran
augustine-tran / function score query
Created November 19, 2013 17:29
Scoring document by count matching tags #elasticsearch #function_score_query
curl -X POST "http://localhost:9200/articles/article" -d '{"title" : "One", "tags" : ["foo"]}'
curl -X POST "http://localhost:9200/articles/article" -d '{"title" : "Two", "tags" : ["foo", "bar"]}'
curl -X POST "http://localhost:9200/articles/article" -d '{"title" : "Three", "tags" : ["foo", "bar", "baz"]}'
curl -X POST articles/article/_search
{
"query": {
"function_score": {
"functions": [
{
"script_score": {
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@augustine-tran
augustine-tran / gist:11147852
Created April 21, 2014 16:27
Vagrant Guest fix bug of Virtual Box 4.3
sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
@augustine-tran
augustine-tran / gist:93a157fada25391b6cbb
Created June 27, 2014 03:24
PhalconEye modal box and callback function
{% extends "../../Core/View/layouts/main.volt" %}
{% block head %}
<script type="text/javascript">
var manageUsersAction = function($btn) {
PhalconEye.widget.modal.open($btn.data('url'), {'callbackFn': 'onAfterUserSelection'});
}
var onAfterUserSelection = function(users) {
var container = $('#assigneesWrapper').html('');