Skip to content

Instantly share code, notes, and snippets.

View mirko77's full-sized avatar

ParanoidAndroid mirko77

View GitHub Profile
@mirko77
mirko77 / dump_post.php
Created March 6, 2015 17:27
Dump POST
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
//echo print_r( $_POST);
//echo print_r($_FILES);
$date = new DateTime();
//echo $date->getTimestamp();
file_put_contents("post_".$date->getTimestamp().".txt", print_r( $_POST, true));
@mirko77
mirko77 / mobile_post.php
Created March 7, 2015 14:21
mobile post request
"Array
(
[HTTP_HOST] => vps140384.ovh.net
[HTTP_CONNECTION] => keep-alive
[HTTP_CACHE_CONTROL] => no-cache
[HTTP_PRAGMA] => no-cache
[HTTP_ACCEPT] => */*
[HTTP_USER_AGENT] => Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36
[HTTP_ACCEPT_ENCODING] => gzip,deflate
[HTTP_ACCEPT_LANGUAGE] => en-GB,en-US;q=0.8
@mirko77
mirko77 / post.php
Last active August 29, 2015 14:16
Example of POST request to Epicollect+, project: http://plus.epicollect.net/post_image_test
/*
* http://plus.epicollect.net/post_image_test
* post request for single entry (data)
*/
Array
(
[table] => test_form
[ecTimeCreated] => 1425745270
[ecPhoneID] => a2439aad10124340
@mirko77
mirko77 / file.php
Created March 7, 2015 18:37
File upload to Epicollect+ (image)
/*
* http://plus.epicollect.net/post_image_test
* post request for single file (image)
*/
Array
(
[name] => Array
(
[name] => test_form_ecplus_test_form_ctrl2_a2439aad10124340_1425745268593.jpg
@mirko77
mirko77 / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mirko77
mirko77 / epicollect5.jscs.json
Created March 12, 2015 09:28
epicollect5 js code style
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
@mirko77
mirko77 / throttling-ajax.js
Created October 29, 2015 16:39
Throttling Ajax request for autocomplete
//populate lists with autocomplete suggestions based on project names on the server
dom_list.on('listviewbeforefilter', function (e, data) {
console.log('typing');
var $ul = $(this);
var $input = $(data.input);
var value = $input.val();
var html = '';
@mirko77
mirko77 / multiline-js
Created November 18, 2015 17:37
Multiline js (for HTML output)
//add bottom border to last element only
if (index === group_input_labels.length - 1) {
HTML += '<div class="ui-block-a group-inputs-grid__label group-inputs-grid-bottom-border">';
HTML += '<div class="ui-bar ui-bar-e" style="height:60px">' + single_label.label + '</div>';
HTML += '</div>';
} else {
HTML += '<div class="ui-block-a group-inputs-grid__label">';
HTML += '<div class="ui-bar ui-bar-e" style="height:60px">' + single_label.label + '</div>';
HTML += '</div>';
}
var askConfirm = function (the_title, the_message, onConfirmCallback, has_data_to_save, the_current_input, is_branch) {
var current_input = the_current_input;
var response;
if (navigator.notification && !EC.Utils.isChrome()) {
var _confirmCallback = function (btn_index) {
console.log('btn_index: ' + btn_index);
@mirko77
mirko77 / address-example.json
Created January 18, 2018 10:01
Epicollect5 connected dropdown with jumps
{
"data": {
"id": "0de0f531f7fb475487d5a71ce4174153",
"type": "project",
"project": {
"ref": "0de0f531f7fb475487d5a71ce4174153",
"name": "Address Example",
"slug": "address-example",
"forms": [
{