Skip to content

Instantly share code, notes, and snippets.

@jsenin
jsenin / pluma-uri-decode.c
Last active August 29, 2015 14:16
mate-desktop pluma uri decode problem poc
/**
* compile gcc `pkg-config --cflags gtk+-3.0` -o pluma-uri-decode pluma-uri-decode.c `pkg-config --libs gtk+-3.0`
* execute:
* ./pluma-uri-decode file:///tmp/pluma/pluma-1.8.1+dfsg1/pluma/pluma-window.c
*
* running as user will enter at mount part and not show uri, only a mount_name
* running as root will not enter at mount
*/
#include <gtk/gtk.h>
@jsenin
jsenin / xchat-greetings-on-joining.py
Created March 25, 2015 13:42
xchat script to greeting on channel joining
__module_name__ = 'Saluda cuando entras'
__module_version__ = '0.1'
__module_description__ = 'Saluda en un canal cuando entras'
__module_author__ = 'nterprais@gmail.com'
import xchat
c = '\x0312'
def on_join(word, word_eol, userdata):
#Add the channels you want to greet people in here, inbetween the ' marks. Example: channels = ['#Jake','#Example']
@jsenin
jsenin / api-rest-option-scanner.js
Created September 28, 2015 19:10
one line jquery to do a request using OPTIONS at headers trying to retrieve supported methods for API REST services
$.ajax('/users/new', {type:'OPTIONS'} ).done( function( data, textStatus) { console.log('->', data ); } );
# gnumeric provides ssconvert tool
# apt-get install gnumeric
ssconvert -S my_xls_file.xls "%s".csv
@jsenin
jsenin / php-empty-arrays.php
Created February 1, 2016 11:11
two ways to handle empty arrays
<?php
/**
* two ways to handle empty arrays
* */
ini_set('error_reporting', E_ALL);
error_reporting(E_ALL);
$foo = array('Establishment' => array());
@jsenin
jsenin / laravel request call params.txt
Last active June 8, 2016 15:35
laravel testing call params explanation $this->call()
$response = $this->call(
'POST',
$path = '/api/foo,
$params,
[],
['file' => $uploadedFile], // instance of new \Symfony\Component\HttpFoundation\File\UploadedFile
$auth
);
call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $headers = null)
#!/bin/bash
# file: .git/hooks/pre-commit
#
# phpcs needed
# apt-get install php-codesniffer
while read -r file;
do
file=${file:2}
$callers=debug_backtrace();
foreach($callers as $call) {
$line = empty($call['line']) ? false : $call['line'];
$file = empty($call['file']) ? false : $call['file'];
$class = empty($call['class']) ? false : $call['class'];
$function = empty($call['function']) ? false : $call['function'];
echo sprintf("%s: %s %s->%s\n", $line, $file, $class, $function );
}
if (! function_exists('dd')) {
function dd($object, $end = true)
{
(new Dumper)->dump($object);
$callers=debug_backtrace();
foreach($callers as $call) {
@jsenin
jsenin / helpers.php
Created August 5, 2016 08:36
improve dd laravel function
/**
* /vendor/laravel/framework/src/Illuminate/Support/helpers.php
*/
if (! function_exists('dd')) {
/**
* Dump the passed variables and end the script.
*
* @param mixed
* @return void