Skip to content

Instantly share code, notes, and snippets.

View realtebo's full-sized avatar
💭
I may be slow to respond.

Mirko Tebaldi realtebo

💭
I may be slow to respond.
  • Somewhere over the raimbow
  • Ferrara, Italy
View GitHub Profile
@victorloux
victorloux / AppServiceProviders.php
Last active October 12, 2020 10:52
@Dump directive for Blade in Laravel 5
// place the following in app/Providers/AppServiceProviders.php, in the boot() method
/**
* Blade directive to dump a variable/object inside a template.
* This is similar to dd(), except that it doesn't interrupt the
* execution of the app. It does NOT support multiple arguments
* however, you have to use one directive per variable.
*
* @example @dump($posts->comments)
*/
@knxroot
knxroot / laravelUseless.flt
Created October 23, 2014 13:51
A WinMerge filter for compare 2 Laravel proyects
## This is a directory/file filter for WinMerge
## This filter is a helper for compare 2 laravel proyects in Windows
name: Exclude Laravel useless
desc: Exclude additional data from Laravel Proyects
## This is an inclusive (loose) filter
## (it lets through everything not specified)
def: include
## Filters for filenames begin with f:
@maxim
maxim / task.yml
Created June 12, 2014 11:09
Adding github to known_hosts with ansible
- name: ensure github.com is a known host
lineinfile:
dest: /root/.ssh/known_hosts
create: yes
state: present
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}"
regexp: "^github\\.com"
@Fysac
Fysac / counter.php
Last active January 20, 2023 17:28
Database-less, sessionless way to count online users in PHP.
<?php
$timeout = 300; // 5 minutes
$time = time();
$ip = $_SERVER["REMOTE_ADDR"];
$file = "users.txt";
$arr = file($file);
$users = 0;
for ($i = 0; $i < count($arr); $i++){
if ($time - intval(substr($arr[$i], strpos($arr[$i], " ") + 4)) > $timeout){
@shirou
shirou / ssh_keyscan.yml
Last active March 14, 2024 12:16
run ssh-keyscan to add keys to known_hosts. This is a playbook for ansible
---
- hosts: all
gather_facts: no
sudo: no
tasks:
- name: run ssh-keyscan to add keys to known_hosts
local_action: shell ssh-keyscan {{ ansible_ssh_host }} >> ~/.ssh/known_hosts
@katowulf
katowulf / firebase_copy.js
Last active July 29, 2022 15:58
Move or copy a Firebase path to a new location
function copyFbRecord(oldRef, newRef) {
oldRef.once('value', function(snap) {
newRef.set( snap.value(), function(error) {
if( error && typeof(console) !== 'undefined' && console.error ) { console.error(error); }
});
});
}
@macdonst
macdonst / back.html
Created May 4, 2011 16:14
PhoneGap Android Back Button Example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>PhoneGap Back Button Example</title>
<script type="text/javascript" charset="utf-8" src="phonegap.0.9.5.js"></script>
<script type="text/javascript" charset="utf-8">
// Call onDeviceReady when PhoneGap is loaded.