Skip to content

Instantly share code, notes, and snippets.

View ssx's full-sized avatar

Scott Robinson ssx

View GitHub Profile
@aaronksaunders
aaronksaunders / index.js
Last active September 25, 2019 08:59
Appcelerator Titanium Alloy ListView & Facebook Friends Part Two. Using the ListView template in view.xml. New feature coming in Alloy 1.2
/**
* called when an item in the ListView is clicked; we will get the section
* index, and addition event information
*
* @param {Object} _event
*/
function loadMoreBtnClicked(_event) {
alert('not implemented yet');
}
@nickdunn
nickdunn / gist:5607392
Last active December 17, 2015 12:09
I run ElasticSearch on the same box as my Apache webserver (one single VPS). I authenticate every request to ElasticSearch.
1. Drop all incoming connections to ElasticSearch on port 9200:
iptables -A INPUT -j DROP -p tcp --destination-port 9200 -i eth0
2. Persist this change on reboot:
iptables-save > /root/my_iptables_config
/sbin/iptables-restore < /root/my_iptables_config
3. Create a directory in your web application, I usually name mine /_es and add an .htaccess file.
@julien-c
julien-c / global.php
Last active December 16, 2015 16:09
Sentry/Monolog integration in Laravel 4
<?php
if (Config::has('sentry.key')) {
$bufferHandler = new Monolog\Handler\BufferHandler(
new Monolog\Handler\RavenHandler(
new Raven_Client(Config::get('sentry.key')),
Monolog\Logger::WARNING
)
);
@damienalexandre
damienalexandre / pony.sh
Created April 15, 2013 09:13
Facets example with ElasticSearch. Building a Filtered Query manualy (or via Elastica) is hell.
# for real, I have a mapping and my color is not "indexed"
curl -XPUT 'http://localhost:9200/pony_index_tmp' -d '
{
settings: {
number_of_shards: 1,
number_of_replicas: 0
}
}'
curl -XPOST "http://localhost:9200/pony_index_tmp/pony/1" -d '
@mstepanov
mstepanov / app.js
Created March 19, 2013 23:19
Titanium ListView Examples
var rootWin = Ti.UI.createWindow();
var navGroup = Ti.UI.iPhone.createNavigationGroup({
window: rootWin
});
var button = Ti.UI.createButton({
title: 'Open ListView Tests'
});
button.addEventListener('click', function() {
openTestsWindow();
});
@FokkeZB
FokkeZB / share.js
Last active April 1, 2016 14:29
A simple example of using Android intents to share texts, URLs and files like you could do using 0x82's ShareKit module (https://marketplace.appcelerator.com/apps/741) or any other similar module (TiSocial: https://github.com/viezel/TiSocial.Framework) for iOS.
function share(options) {
if (OS_ANDROID) {
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_SEND
});
intent.putExtra(Ti.Android.EXTRA_SUBJECT, options.title);
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
# Download the compiled elasticsearch rather than the source.
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@zaeleus
zaeleus / gitlab_centos6.txt
Created December 23, 2012 08:04
Gitlab install on CentOS 6.3 (2012-09-13)
-- install packages
# yum update
# yum groupinstall "Development Tools" "Additional Development"
-- epel for redis, libyaml, pip, qtwebkit-devel
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
# yum install libicu-devel libyaml-devel redis wget python-pip qt-devel qtwebkit-devel
-- install ruby
@ricardoalcocer
ricardoalcocer / detailwin.js
Created November 23, 2012 20:27
Basic Alloy : Dynamic TableView Handling + Open Window
var args = arguments[0] || {};
$.rowId.text=args.rowId;
$.itemName.text=args.itemName;
function closeme(){
$.win.close();
}
@benshimmin
benshimmin / gist:4088493
Created November 16, 2012 16:03
Scale to fit and centre-align an image with FPDF
<?php
/* Caveat: I'm not a PHP programmer, so this may or may
* not be the most idiomatic code...
*
* FPDF is a free PHP library for creating PDFs:
* http://www.fpdf.org/
*/
require("fpdf.php");
class PDF extends FPDF {