Skip to content

Instantly share code, notes, and snippets.

View theanam's full-sized avatar
One coffee every five minute.

Anam Ahmed theanam

One coffee every five minute.
View GitHub Profile
@milon
milon / elasticsearch_on_homestead.md
Last active November 23, 2022 15:18
Install Elasticsearch on Laravel Homestead

Install Elasticsearch on Laravel Homestead

Install Java

sudo apt-get install openjdk-7-jre-headless -y

Download & install the Public Signing Key

wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -
@hasinhayder
hasinhayder / gist:60c4fa9ca16a31ab8763
Created February 18, 2015 19:39
counter problem v 2
var counter = function(arg){
arg = arg == undefined ? 1 : arg;
var me = arguments.callee;
return me.count ? ( me.count += arg, me.count ) : ( me.count = arg, me );
}
var cnt = counter(5);
cnt();
cnt();
console.log(cnt(5)); //shud return 12
@hasinhayder
hasinhayder / enq-js.php
Last active March 4, 2016 15:59
generate wp_enqueue_script calls for all the js files in the current directory
#!/usr/bin/env php
<?php
foreach(glob("*.js") as $js){
echo "wp_enqueue_script( 'wptheme-{$js}', get_template_directory_uri().'/js/{$js}', array('jquery'),'1.0',true);\n";
}
@lalinsky
lalinsky / ingest.php
Created April 18, 2012 20:34
Simple audio fingerprint matching in PHP
<?php
include "utils.php";
$fp = parse_fp($_GET['fp']);
$dbh = new PDO('mysql:host=localhost;dbname=fingerprint', 'fingerprint');
$dbh->beginTransaction();
$sth = $dbh->prepare("INSERT INTO fp (length) VALUES (?)");