Skip to content

Instantly share code, notes, and snippets.

@gobinathm
gobinathm / shallow_update_git.md
Created March 6, 2017 18:24
Fix for Remote rejected shallow update not allowed after changing Git remote URL

Some Time there is a shallow update not allowed issue in your cloned GIT repo.

This means that you have to unshallow your repository. To do so you will need to add your old remote again.

git remote add origin <path-to-old-remote> After that we use git fetch to fetch the remaining history from the old remote (as suggested in this answer).

git fetch --unshallow origin And now you should be able to push into your new remote repository.

@MohammadaliMirhamed
MohammadaliMirhamed / PhpFireBaseNotificationSample.php
Last active December 28, 2024 22:56
This repository showcases a simple and effective script to send push notifications to Android devices using Firebase Cloud Messaging (FCM). Designed for developers, the code provides a quick setup for integrating FCM notifications with minimal configuration.
<?php
#API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-SERVER-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = $_GET['id'];
#prep the bundle
$msg = array
(
'body' => 'Body Of Notification',
@Page-Carbajal
Page-Carbajal / get-post-thumbnail.gist.class.php
Last active May 19, 2018 03:20
WordPress - Get Post Thumbnail URL
<?php
/**
* Return the Post Thumbnail URL if $post has thumbnail
* $post is a WordPress Post Object
* @param $post
* @return string
*/
private function getPostThumbnailURL( $post ){
if ( has_post_thumbnail( $post->ID ) ){
@sarathlal-old
sarathlal-old / transfer-copy.php
Created July 29, 2015 10:01
Transfer files from server to server using PHP `copy()` function.
<?php
// Insert this file on server and go to the path from browser.
set_time_limit(0); //Unlimited max execution time
/* Source File URL */
$remote_file_url = 'http://origin-server-url/files.zip';
/* New file name and path for this file */
$local_file = 'files.zip';
this.watchID = navigator.geolocation.watchPosition((lastPosition) => {
var native = require('NativeModules').Native;
native.locationFromLatitude(lastPosition.coords.latitude, lastPosition.coords.longitude)
});
var subscription = require('RCTDeviceEventEmitter').addListener(
'LocationInfo',
(location) => console.log(location.cityName)
);
@banderon
banderon / wp - user has role
Last active December 27, 2017 15:21
wordpress user has role check
<?php
/**
* Check if a role is assigned to a particular user
*
* @param string $role
* @param int $user_id
* @return bool
*/
function user_has_role( $role, $user_id = null ) {
if ( is_numeric( $user_id ) ) {
@tschoffelen
tschoffelen / install.php
Last active February 12, 2024 09:20
A simple PHP script that automatically downloads and unzips the latest version of Wordpress in the current directory (./), so that I don't have to download it and upload it to my server through FTP manually.
<?php
echo '<pre>';
echo '<span style="color:blue">DOWNLOADING...</span>'.PHP_EOL;
// Download file
file_put_contents('wp.zip', file_get_contents('https://wordpress.org/latest.zip'));
$zip = new ZipArchive();
$res = $zip->open('wp.zip');
if ($res === TRUE) {
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>