Skip to content

Instantly share code, notes, and snippets.

View anggiaj's full-sized avatar

anggiaj anggiaj

  • Jakarta, Indonesia
View GitHub Profile
curl -X GET "http://localhost:9200/licence-finder/_search?pretty=true" -d '{"query":{"query_string":{"query":"title.autocomplete:organ*"}},"sort":[{"title.sortable":"asc"}]}'
{
"took" : 72,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
# First, create the synonyms file /opt/elasticsearch/name_synonyms.txt
# with the contents:
#
# rob,bob => robert
#
## CREATE THE INDEX WITH ANALYZERS AND MAPPINGS
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
{
// http://stackoverflow.com/questions/1114024/constructors-in-javascript-objects
var MyClass = (function () {
// private static
var nextId = 1;
// constructor
var cls = function () {
// private
var id = nextId++;
var name = 'Unknown';
@anggiaj
anggiaj / CopyAttributesBehavior.php
Created March 20, 2013 07:47
kelas sederhana untuk meng-kopi (value) antara model satu dengan lainnya
<?php
/**
* @author Anggiajuang Patria <anggiaj@gmail.com>
* 3/20/13/2:32 PM
*/
/**
* Class CopyAttributesBehavior
* kelas sederhana untuk meng-kopi (value) antara model satu dengan lainnya
@anggiaj
anggiaj / reciepies.sh
Created April 11, 2013 04:27
Resep bash
# Bunuh banyak proses sekaligus
kill $(ps aux | grep '[/]bin/bash /home/mcmforex/shell/mq.sh' | awk '{print $2}')
# Cari file besar
ls -lSh . | head -5
#!/bin/bash
# Pull this file down, make it executable and run it with sudo
# wget https://raw.github.com/gist/6152521/build-erlang-r16b01.sh
# chmod u+x build-erlang-r16b01.sh
# sudo ./build-erlang-r16b01.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi
@anggiaj
anggiaj / Cards.php
Created August 31, 2013 12:25
Cards
<?php
class Cards
{
private $cards;
private $card;
public function __construct(Card $card = null)
{
$this->card = $card;
}
@anggiaj
anggiaj / CardsTest.php
Created August 31, 2013 12:26
Cards test
<?php
include __DIR__ . '/Cards.php';
/**
* Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2013-08-31 at 19:17:43.
*/
class CardsTest extends PHPUnit_Framework_TestCase
{
/**
* @var Cards
http://www.net-snmp.org/wiki/index.php/Git_Workflow
https://console.moovweb.com/learn/docs/cloud/workflow
http://newtriks.com/2011/12/01/automated-deployment-using-git/
@anggiaj
anggiaj / createphpproject.php
Created September 6, 2013 17:26
quick create project for me :D
#!/usr/bin/env php
<?php
if (!isset($argv[1])) {
echo "Usage: createphpproject {project_name}\n\n";
exit;
}
$projectName = trim($argv[1]);
$workingDir = str_replace('\\', '/', __DIR__);
$targetDir = (isset($argv[2]) ? trim($argv[2]) : $workingDir) . '/' . $projectName;