Skip to content

Instantly share code, notes, and snippets.

View dexit's full-sized avatar
🎯
Focusing

Rihards Mantejs dexit

🎯
Focusing
View GitHub Profile
@dexit
dexit / fcm.php
Created June 2, 2018 11:17 — forked from sab99r/fcm.php
PHP Function to Send FCM Message to Android
<?php
/*
Parameter Example
$data = array('post_id'=>'12345','post_title'=>'A Blog post');
$target = 'single tocken id or topic name';
or
$target = array('token1','token2','...'); // up to 1000 in one request
*/
public function sendMessage($data,$target){
//FCM api URL
@dexit
dexit / php-pdo-mysql-crud.md
Created July 27, 2018 11:24 — forked from taniarascia/php-pdo-mysql-crud.md
Basic CRUD operations with PDO and MySQL

Basic CRUD operations with PDO

CRUD = Create, Read, Update, Delete

Open a database connection

$host = '127.0.0.1';
$dbname = 'test';
$username = 'root';
* Downloaded or downloading
=============================
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html
@dexit
dexit / mobileUA.php
Created August 17, 2018 11:01 — forked from dcondrey/mobileUA.php
Detect User Agent with PHP
<?php
class Mobile_Detect {
protected $accept;
protected $userAgent;
protected $isMobile = false;
protected $isAndroid = null;
protected $isBlackberry = null;
@dexit
dexit / Get-Traceroute.ps1
Created October 5, 2018 13:21 — forked from tylerapplebaum/Get-Traceroute.ps1
MTR for Powershell
<#
.SYNOPSIS
An MTR clone for PowerShell.
Written by Tyler Applebaum.
Version 2.0
.LINK
https://gist.github.com/tylerapplebaum/dc527a3bd875f11871e2
http://www.team-cymru.org/IP-ASN-mapping.html#dns
@dexit
dexit / vhost.sh
Created October 8, 2018 09:04 — forked from mattmezza/vhost.sh
bash script to create virtual host vhost with apache httpd and CentOs 7
#!/bin/bash
# This script is used for create virtual hosts on CentOs.
# Created by alexnogard from http://alexnogard.com
# Improved by mattmezza from http://you.canmakethat.com
# Feel free to modify it
# PARAMETERS
#
# $usr - User
# $dir - directory of web files
# $servn - webserver address without www.
@dexit
dexit / class-boilerplate.php
Created October 24, 2018 07:50 — forked from Nikschavan/class-boilerplate.php
Boilerplate for a PHP class
<?php
/**
* CLASS_NAME setup
*
* @since 1.0
*/
class CLASS_NAME {
private static $instance;
@dexit
dexit / api.php
Created May 3, 2019 17:32
Disable WordPress REST API endpoints
// Remove init rest routes
remove_action( 'rest_api_init', 'create_initial_rest_routes', 0 );
// Remove oembed rest routes
function remove_json_api () {
// Remove the REST API lines from the HTML Header
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
@dexit
dexit / custom-notification.php
Created June 4, 2019 18:28 — forked from modemlooper/custom-notification.php
BuddyPress add custom notification
<?php
// this is to add a fake component to BuddyPress. A registered component is needed to add notifications
function custom_filter_notifications_get_registered_components( $component_names = array() ) {
// Force $component_names to be an array
if ( ! is_array( $component_names ) ) {
$component_names = array();
}
// Add 'custom' component to registered components array
@dexit
dexit / wordpress-upload-base64.php
Created June 4, 2019 18:29 — forked from modemlooper/wordpress-upload-base64.php
Upload a base64 string as image to the WordPress media library
/**
* Save the image on the server.
*/
function save_image( $base64_img, $title ) {
// Upload dir.
$upload_dir = wp_upload_dir();
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR;
$img = str_replace( 'data:image/jpeg;base64,', '', $base64_img );