Skip to content

Instantly share code, notes, and snippets.

View MartelliEnrico's full-sized avatar
🏠
Working from home

Enrico Martelli MartelliEnrico

🏠
Working from home
View GitHub Profile
@MartelliEnrico
MartelliEnrico / uarm.rb
Last active January 12, 2016 10:02
brew cask install uarm
cask 'uarm' do
version '1.0-beta'
sha256 '978c4b46972810d618fdce98e7f833c69c1a0657ea254695032b372ba5e048c6'
url 'https://github.com/MartelliEnrico/uARM/archive/master.zip'
name 'uarm'
homepage 'http://mellotanica.github.io/uARM/'
license :unknown
installer :script => "install.sh"
@MartelliEnrico
MartelliEnrico / defer.h
Last active December 17, 2023 05:44
C defer for GCC
#pragma once
#define defer_(x) \
void _dtor_##x(); \
int __attribute__((cleanup(_dtor_##x))) _dtorV_##x; \
void _dtor_##x()
#define defer__(x) defer_(x)
#define defer defer__(__COUNTER__)
@MartelliEnrico
MartelliEnrico / cliTCP.c
Last active November 21, 2015 17:38
Send ip packet from client to server, and back again.
/* cliTCP.c spedisce stringa, riceve stringa traslata
su SunOS compilare con gcc -o cliTCP.c -lsocket -lnsl cliTCP.c
su linux gcc -o cliTCP cliTCP.c
eseguire ad esempio su 137.204.72.49 lanciando la seguente riga di comandi
cliTCP 130.136.2.7 5001
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/PenPalTheme"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
@MartelliEnrico
MartelliEnrico / cookies.css
Last active August 29, 2015 14:23
Cookie Banner
#cookieBanner {
background-color: #000;
background-color: rgba(0, 0, 0, 0.8);
padding: 10px;
color: #fff;
text-align: center;
}
#cookieBanner span a {
margin-left: 10px;
var animate = function() {
var t = {delay: 0,duration: 400,easing: "0.645 0.045 0.355, 1"}, e = function() {
return Array.prototype.includes ? function(t, e) {
return t.includes(e)
} : function(t, e) {
return t.some(function(t) {
return t === e
})
}
}(), n = function() {
class Data {
protected:
int day_, month_, year_;
bool valid_;
bool isLeapYear(int year)
{
return year % 4 == 0;
}
#!/bin/bash
CMD="env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh;
brew update; brew upgrade; brew cleanup;
composer self-update; composer global update; homestead update"
if [ "$1" = "-b" ]; then
> ~/.upgrade.log
eval "( $CMD ) >~/.upgrade.log 2>&1 &"
else
eval $CMD
<?php
function _filterEmail($email)
{
$rule = array("\r" => '', "\n" => '', "\t" => '', '"' => '', ',' => '', '<' => '', '>' => '');
return strtr($email, $rule);
}
function _filterName($name)
@MartelliEnrico
MartelliEnrico / Model.php
Last active August 29, 2015 14:10
Model.php
<?php
use Illuminate\Database\Eloquent\Model as Eloquent;
class Model extends Eloquent {
public function scopeNext($query)
{
$id = $this->getKeyName();
$query = $this->newQuery();