Skip to content

Instantly share code, notes, and snippets.

View fernandez14's full-sized avatar

Carlos Eduardo Fernández fernandez14

View GitHub Profile
(def bit-bucket-writer
(proxy [java.io.Writer] []
(write [buf] nil)
(close [] nil)
(flush [] nil)))
(defmacro noprint
"Evalua la expresiones dadas con todas las impresiones a *out* silenciadas."
[& forms]
`(binding [*out* bit-bucket-writer]
@fernandez14
fernandez14 / ProgressBar.php
Created November 5, 2014 17:48
ConsoleKit Progress bar fix
<?php
/*
* This file is part of the ConsoleKit package.
*
* (c) 2012 Maxime Bouroumeau-Fuseau
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@fernandez14
fernandez14 / gist:0e49b1941e1d2e5a3b85
Created November 12, 2014 16:25
Forking curl process
<?php
private function request($url, $payload) {
$cmd = "curl -X POST -H 'Content-Type: application/json'";
$cmd.= " -d '" . $payload . "' " . "'" . $url . "'";
if (!$this->debug()) {
$cmd .= " > /dev/null 2>&1 &";
}
@fernandez14
fernandez14 / gist:74838a73834ee7d30a78
Created December 11, 2014 00:02
Start neighborhoods indexing
forever start -c php app/cli.php index neighborhoods
[2015-05-15 18:31:35] local.ERROR: exception 'ReflectionException' with message 'Class cache does not exist' in /Users/fernandez104/Documents/AdmitOne/admitone/vendor/laravel/framework/src/Illuminate/Container/Container.php:776
Stack trace:
#0 /Users/fernandez104/Documents/AdmitOne/admitone/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): ReflectionClass->__construct('cache')
#1 /Users/fernandez104/Documents/AdmitOne/admitone/vendor/laravel/framework/src/Illuminate/Container/Container.php(656): Illuminate\Container\Container->build('cache', Array)
#2 /Users/fernandez104/Documents/AdmitOne/admitone/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(644): Illuminate\Container\Container->make('cache', Array)
#3 /Users/fernandez104/Documents/AdmitOne/admitone/vendor/laravel/framework/src/Illuminate/Container/Container.php(1231): Illuminate\Foundation\Application->make('cache')
#4 /Users/fernandez104/Documents/AdmitOne/admitone/vendor/laravel/framework/src/Illuminate/Session/Se
<?php
/**
* @Get("/{id:[0-9]+}")
* @AclAllow("scopes"={"basic"})
*/
public function getAction($id)
{
Filter::on($this, __FUNCTION__, func_get_args(), function($chain) {
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Authentication Driver
|--------------------------------------------------------------------------
|
| This option controls the authentication driver that will be utilized.
/*
* Search and replace a string with another string , in a string
* */
char *str_replace(char *search , char *replace , char *subject)
{
char *p = NULL , *old = NULL , *new_subject = NULL ;
int c = 0 , search_size;
search_size = strlen(search);
@fernandez14
fernandez14 / selector-example.json
Created March 29, 2017 01:54
Spider-srv API calls examples.
{
"name": {"use": "text", "value": "h1 span", "filters": ["trim-space"]},
"screen": {"use": "text", "value": "#phone div[data-gallery] .col-xs-16 div.bor-t-1", "filters": ["trim-space"]},
"os": {"use": "text", "value": "#phone div[data-gallery] .col-xs-16 div.bor-t-1", "i": 1, "filters": ["trim-space"]},
"camera": {"use": "text", "value": "#phone div[data-gallery] .col-xs-16 div.bor-t-1", "i": 2, "filters": ["trim-space"]},
"storage": {"use": "text", "value": "#phone div[data-gallery] .col-xs-16 div.bor-t-1", "i": 3, "filters": ["trim-space"]},
}
@fernandez14
fernandez14 / prepare-datasets.sh
Last active January 2, 2022 00:32
Spider-srv API calls examples.
micro query sg.micro.srv.spider Spider.PrepareDatasets '{
"selector_id": 1,
"group": "motorcycle"
}'