Skip to content

Instantly share code, notes, and snippets.

@agustinhaller
agustinhaller / ParseImageURL.php
Created February 26, 2014 18:11
Given any image url, it returns the base64 image
<?php
// Given any image url, it returns the base64 image
function ParseImageURL()
{
// $image_url = (isset($_REQUEST["image_url"]) && $_REQUEST["image_url"]!=null) ? $_REQUEST["image_url"] : null;
$image_url = "https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-prn1/t1/p526x296/1965014_10153859707455111_1422873058_n.jpg";
// $image_url = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIWFRQBAwQEBgUGCgYGChAODA0QFA8OEAwNDQ8QDw0ODhANEA8MDA8PDxAQFA4VDw8PDhANDQ4ODRAQDw8UDhAMDA0MDP/AABEIACwALAMBEQACEQEDEQH/xAAaAAADAAMBAAAAAAAAAAAAAAAHCAkDBQYE/8QANBAAAQMDAwMCAwUJAQAAAAAAAQIDBAUGEQAHIQgSMRNBFCJxFzJCYYEVFiM0Q1FTcpEJ/8QAGgEAAgMBAQAAAAAAAAAAAAAAAwQABQYCAf/EACsRAAEDAwIEBQUBAAAAAAAAAAEAAgMREjEEIRNBUfBxgZGhwQUUImHRsf/aAAwDAQACEQMRAD8AfZtXA0wuFnR51FKrX3jd1N29s2uXRWFqbpVFgvVCUpsZV6baCtQSPdRAwB7kjUUUO7yvW/uszeebcc1Dji1r7I8NtwmPTI/4Gkk8ADyTgFSsnydIT6hkQq4+ATmn0z5zaweJ5BF66+gLcyltQbkiINXSyhC3YkBKlyEYGThJyFeM8YGST76Wh1okdu0jompdAWD8X
//
// HomeViewController.m
// SlidingPanels
//
// Created by Agus on 05/03/14.
// Copyright (c) 2014 StartAppLabs. All rights reserved.
//
#import "HomeViewController.h"
#import "DynamicTransition.h"
{% extends "layout.html" %}
{% block main_content %}
<div class="test-content">
<div class="main-wrapper">
{# Slogan #}
<div class="slogan-container row">
<h2 class="main-slogan">Face Crop TESTS</h2>
</div>
@agustinhaller
agustinhaller / gettext_install.sh
Created May 29, 2014 06:06
attempt to install gettext php extension in mountain lion osx
# Download from: http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.3.2.tar.gz
cd ~/Downloads
tar xzvf gettext-0.18.3.2.tar.gz
cd gettext-0.18.3.2
./configure
make
sudo make install
# If this doesn't work, then install gettext using "brew install gettext"
@agustinhaller
agustinhaller / gist:9d48bcfd070460935f14
Created June 1, 2014 06:49
Prepare gettext php extension for heroku
# First tar.gz the gettext php extension files we need
cd Downloads/
tar -pvczf php-5.5.12_ext_gettext.tar.gz php-5.5.12_ext_gettext
# Then upload them to s3
@agustinhaller
agustinhaller / falcon-site.sh
Created June 11, 2014 19:23
falcon site creator
#!/bin/bash
BASE_REPOS_PATH=/Users/agustinhaller/repos
DEVELOPMENT_PREFIX=dev
HOSTS_PATH=/etc/hosts
APACHE_CONF_PATH=/private/etc/apache2/other
echo "creating local domain development ... $DEVELOPMENT_PREFIX.$1"
#CREATE DIRECTORY AND GIVE PERMISSIONS
DirectoryIndex site/index.html
FileETag none
ServerSignature Off
Options All -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
.controller('TreeDemoCtrl', function($scope, $http, $log) {
$scope.list = [];
$http.get('tx_1.json')
// $http.get('taxonomy.json')
.then(function(res){
$scope.list = res.data;
});
<div class="page" ng-controller="TreeDemoCtrl">
<div class="row">
<div class="col-md-6">
<section class="panel panel-default">
<div class="panel-heading"><strong><span class="glyphicon glyphicon-th"></span> Taxonomia</strong></div>
<div class="panel-body">
<div id="app-taxonomy" class="app-taxonomy" ui-tree="options" data-drag-enabled="false">
<ol ui-tree-nodes ng-model="list" >
<li ng-repeat="item in list" ui-tree-node data-collapsed="true" ng-include="'items_renderer.html'"></li>
</ol>
Faceted Search
Faceted search takes the documents matched by a query and generates counts for various properties or categories. Links are usually provided that allows users to "drill down" or refine their search results based on the returned categories.
The following example searches for all documents (*:*) and requests counts by the category field cat.
...&q=*:*&facet=true&facet.field=cat
Notice that although only the first 10 documents are returned in the results list, the facet counts generated are for the complete set of documents that match the query.