Skip to content

Instantly share code, notes, and snippets.

Nicola usainicola

Block or report user

Report or block usainicola

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:a1567b5af56367656c49645cbf774e27
<pre>
<?php
$path = realpath(__DIR__);
echo "<p>Zipping...</p>";
$zip = new ZipArchive();
$zip->open(dirname(__FILE__).'.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
foreach ($files as $name => $file) {
if ($file->isDir()) {
echo $name . "\r\n";
View gist:18ff389e5f5ec9953fa2f73c07ebbc33
function distance(lat1, lon1, lat2, lon2) {
var p = 0.017453292519943295; // Math.PI / 180
var c = Math.cos;
var a = 0.5 - c((lat2 - lat1) * p)/2 +
c(lat1 * p) * c(lat2 * p) *
(1 - c((lon2 - lon1) * p))/2;
return 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km
}
View gist:cee888a202d9f2e9a8692f7696225714
<?php
function distance($latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo) {
$rad = M_PI / 180;
$theta = $longitudeFrom - $longitudeTo;
$dist = sin($latitudeFrom * $rad) * sin($latitudeTo * $rad) + cos($latitudeFrom * $rad) * cos($latitudeTo * $rad) * cos($theta * $rad);
return acos($dist) / $rad * 60 * 1.852;
}
View gist:3c16d891505641b45909f9eaa84e7a07
<?php
// column post image
function add_thumb_column($cols) {
$cols['thumbnail'] = 'Image';
return $cols;
}
function add_thumb_value($column_name, $post_id) {
$width = (int) 120;
View gist:d41d27c6d3b9e927f588a548e067819e
<?php
function ajax_get_template_part() {
check_ajax_referer('ajax_get_template_part','nonce');
$part = esc_attr($_POST['template_part']);
if (!$part) {return;}
get_template_part($part);
die();
}
add_action( 'wp_ajax_nopriv_ajax_get_template_part', 'ajax_get_template_part' );
View gallery_custom.php
View gist:61a80a3dc675a25e2b9c8ffc2509527a
.waves-effect {
position: relative;
overflow: hidden;
display: inline-block;
}
.ripple {
width: 0;
height: 0;
border-radius: 50%;
background: rgba(255, 255, 255, 0.4);
View gist:dc43411d20327f4bed48488fc0852079
.row {
display: grid;
grid-gap: var(--s11);
grid-template-columns: repeat(auto-fit, minmax(var(--s24), 1fr));
}
@media screen and (max-width: 600px) {
.row {
grid-template-columns: none;
}
View calendario.css
.cControls {
display: flex;
justify-content: space-between;
align-items: center;
margin: 20px 0;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
You can’t perform that action at this time.