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
package solitari;
public class Carta {
int numero;
int seme;
public Carta(int numero, int seme) {
this.numero = numero;
this.seme = seme;
@MartelliEnrico
MartelliEnrico / gist:6622773
Last active December 23, 2015 10:39
Metodo per separare Cognome e Nome in due campi, con l'utilizzo del codice fiscale.
private static String getConsonanti(String stringa) {
String risultato = "";
for(int i = 0; i < stringa.length(); i++) {
if("AEIOU".indexOf(stringa.charAt(i)) == -1) {
risultato += stringa.charAt(i);
}
}
return risultato;
}
(function(d,b,e,g){for(var h=e-b,c=Array(d),f={};b<=e;b++){var a=b;do a=a.toString().split("").reduce(function(a,b){return parseInt(a,10)+parseInt(b,10)});while(a>d||-1<g.indexOf(a));c[a-1]=void 0===c[a-1]?1:c[a-1]+1}c.forEach(function(a,b){f[b+1]=100*a/h});return f})(24,1362,1832,[17]);
@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();
<?php
function _filterEmail($email)
{
$rule = array("\r" => '', "\n" => '', "\t" => '', '"' => '', ',' => '', '<' => '', '>' => '');
return strtr($email, $rule);
}
function _filterName($name)
#!/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
class Data {
protected:
int day_, month_, year_;
bool valid_;
bool isLeapYear(int year)
{
return year % 4 == 0;
}
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() {
@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;
<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">