Skip to content

Instantly share code, notes, and snippets.

View daino92's full-sized avatar
🎯
Focusing

Dionysis Kalepanagos daino92

🎯
Focusing
  • Pireaus University of Applied Sciences
  • Athens, Greece
View GitHub Profile
@michaelaguiar
michaelaguiar / autocomplete.js
Created May 18, 2020 15:29
Google Maps Address Autocomplete
function initAutoComplete() {
var input = document.getElementById("grid-address");
var autocomplete = new google.maps.places.Autocomplete(input);
autocomplete.addListener("place_changed", function () {
let place = autocomplete.getPlace();
let address = "";
if (place.address_components) {
address = [
@AustinGil
AustinGil / functions.php
Last active September 14, 2020 11:56
JSON-LD for WordPress posts
/**
* Remove hentry from post_class
* This is important to not get schema errors
*/
function visceral_remove_hentry_class( $classes ) {
$classes = array_diff( $classes, array( 'hentry' ) );
return $classes;
}
add_filter( 'post_class', 'visceral_remove_hentry_class' );
@joelrojo
joelrojo / ajax_cheat_sheet.md
Last active February 6, 2024 08:35
AJAX 101 cheat sheet

#AJAX

What is AJAX

"AJAX an acronym for asynchronous JavaScript and XML is a group of interrelated web development techniques used on the client-side to create asynchronous web applications. With Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. Data can be retrieved using the XMLHttpRequest object. Despite the name, the use of XML is not required (JSON is often used instead), and the requests do not need to be asynchronous." - wikipedia

AJAX with jQuery

jQuery provides a $.ajax() method with a set of options for sending requests and callback methods to handle responses.

  • Here is the most basic $.ajax() request that does not send any data. It will be handled by the post '/trips' route on the server. You can choose any of the http request verbs for the type parameter (get, post, put, delete)
@wojteklu
wojteklu / clean_code.md
Last active July 21, 2024 20:10
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@hootlex
hootlex / laravellocal.md
Last active June 26, 2024 08:56
Run laravel project locally

##Windows users:

cmder will be refered as console

##Mac Os, Ubuntu and windows users continue here:

  • Create a database locally named homestead utf8_general_ci
@tbranyen
tbranyen / _usage.md
Last active April 19, 2024 12:24
OpenWeatherMap / Weather Icons integration
  1. Include Weather Icons in your app: https://github.com/erikflowers/weather-icons

  2. Include the below JSON in your application, for example purposes, lets assume it's a global named weatherIcons.

  3. Make a request to OpenWeatherMap:

req = $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=?');
@amochohan
amochohan / 01_Laravel 5 Simple ACL manager_Readme.md
Last active July 16, 2024 18:08
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

<?php
/*
Plugin Name: MemberPress Account Page Nav
Plugin URI: http://www.memberpress.com/
Description: Allows developers to add more nav menu links/pages to their members account page
Version: 1.0.0
Author: Caseproof, LLC
Author URI: http://caseproof.com/
Copyright: 2004-2013, Caseproof, LLC
*/
@msurguy
msurguy / List.md
Last active April 30, 2024 15:14
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):

@tdoumas
tdoumas / afm-validator.js
Created December 9, 2013 16:44
Αλγόριθμος ορθότητας ΑΦΜ Greek Tax Registration Number Validation (AFM)
// Greek Tax Registration Number Validation (AFM)
// Αλγόριθμος ορθότητας ΑΦΜ
function validateAFM(afm) {
if (!afm.match(/^\d{9}$/) || afm == '000000000')
return false;
var m = 1, sum = 0;
for (var i = 7; i >= 0; i--) {
m *= 2;
sum += afm.charAt(i) * m;