Skip to content

Instantly share code, notes, and snippets.

View AndreiTelteu's full-sized avatar

Andrei Telteu AndreiTelteu

View GitHub Profile
@peltho
peltho / svelte.md
Last active April 2, 2024 07:43
Svelte cheatsheet
@skadimoolam
skadimoolam / checkbox.blade.php
Last active February 8, 2020 17:03
Customizable form partials for Laravel - https://laravelcollections.com
@php
$d = $d ?? null; // default value
@endphp
<div class="form-group row">
<label for="{{ $n }}" class="col-sm-4 col-form-label text-md-right"><b>{{ $l }}</b></label>
<div class="col-md-8">
<input id="{{ $n }}" type="checkbox" class="form-control" name="{{ $n }}" value="1" @if(old($n, $d) == '1') checked @endif>
@if ($errors->has($n))
<small class="text-danger">{{ $errors->first($n) }}</small>
@brunotdantas
brunotdantas / downloadSheet.php
Created November 22, 2018 12:16
Create a spreadsheet with phpSpreadSheet (https://github.com/PHPOffice/PhpSpreadsheet) #Excel #xls #xlsx
<?php
// requiring autoload with the pluguin
require __DIR__ . '/../../vendor/autoload.php';
// invoking needed classes
use PhpOffice\PhpSpreadsheet\Spreadsheet; //class responsible to change the spreadsheet
use PhpOffice\PhpSpreadsheet\Writer\Xlsx; //class that write the table in .xlsx
$spreadsheet = new Spreadsheet(); //instanciando uma nova planilha
@Awea
Awea / docker-compose.yml
Created March 21, 2018 12:28
Docker compose: PHP (5.4), composer, Apache, MySQL and phpMyAdmin
version: '3'
services:
api:
image: alterway/php:5.4-apache
environment:
PHP_php5enmod: 'mysqli'
HTTPD_a2enmod: 'rewrite headers'
volumes:
# ./api contains my PHP application
- "./api:/var/www/html"
@maddisondesigns
maddisondesigns / create-wp-admin.php
Created October 4, 2017 01:10
Create a new WordPress Administrator User
<?php
// ADD NEW ADMIN USER TO WORDPRESS
// ----------------------------------
// Put this file in your Wordpress root directory and run it from your browser.
// Delete it when you're done.
// Original script by Joshua Winn - https://joshuawinn.com/create-a-new-wordpress-admin-user-from-php
require_once('wp-blog-header.php');
require_once('wp-includes/registration.php');
@butlerblog
butlerblog / functions.php
Last active March 28, 2024 02:09
SMTP using wp-config.php for settings #smtp #wp_mail
<?php // Don't use this line.
/*
* Add the script below to wherever you store custom code snippets
* in your site, whether that's your child theme's functions.php,
* a custom plugin file, or through a code snippet plugin.
*/
/**
* This function will connect wp_mail to your authenticated
@ProfFan
ProfFan / FlarumValetDriver.php
Created July 22, 2016 16:42
Larvel Valet Flarum Driver
<?php
class FlarumValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@Kelderic
Kelderic / custom_post_types.php
Last active August 8, 2023 13:39
This is set of helper classes to create and manage custom post types for WordPress. It gets added to a theme's logic folder, or libs or includes folders, and included in functions.php. Then the primary tracker class is initiated once, and used to create new CTPs.
<?php
/***********************************************************************/
/*************************** TRACKER CLASS ***************************/
/***********************************************************************/
if ( ! class_exists( 'Custom_Post_Types_Manager' ) ) {
class Custom_Post_Types_Manager {
@ayamflow
ayamflow / gist:b602ab436ac9f05660d9c15190f4fd7b
Created May 9, 2016 19:10
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
@viperwarp
viperwarp / ReactNativeJson.java
Created February 24, 2016 03:02
React-Native Module, ReadableMap/Array to Java JSON objects
private static WritableMap convertJsonToMap(JSONObject jsonObject) throws JSONException {
WritableMap map = new WritableNativeMap();
Iterator<String> iterator = jsonObject.keys();
while (iterator.hasNext()) {
String key = iterator.next();
Object value = jsonObject.get(key);
if (value instanceof JSONObject) {
map.putMap(key, convertJsonToMap((JSONObject) value));
} else if (value instanceof JSONArray) {