Skip to content

Instantly share code, notes, and snippets.

View iamRahul1973's full-sized avatar
🏠
Working from home

Rahul K iamRahul1973

🏠
Working from home
View GitHub Profile
@JeffreyWay
JeffreyWay / console.php
Created October 26, 2021 17:16
Example Artisan "tail" command
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Symfony\Component\Process\Process;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js" defer></script>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
</head>
<body>
<?php
namespace App;
class Player
{
/**
* @var string
*/
public string $name;
@laracasts
laracasts / RomanNumerals.php
Created December 15, 2019 18:47
Roman numerals Kata
<?php
namespace App;
class RomanNumerals
{
const NUMERALS = [
'M' => 1000,
'CM' => 900,
'D' => 500,
@jagels
jagels / functions.php
Created March 14, 2017 09:45
Add text field above "Proceed to checkout" button on the cart page in WooCommerce
//Add shipping info above the proceed to checkout button
add_action('woocommerce_proceed_to_checkout', 'jagels_custom_checkout_field');
function jagels_custom_checkout_field() {
echo '<p><small>Levering innen 2-5 virkedager.</small></p>';
}
<?php
namespace App\Services;
use App\Post;
class Slug
{
/**
* @param $title
@JeffreyWay
JeffreyWay / .vimrc
Created January 28, 2016 05:18
Laracasts: Vim Mastery - Episode 3 .vimrc progress
syntax enable
colorscheme desert
"-------------General Settings--------------"
set backspace=indent,eol,start "Make backspace behave like every other editor.
let mapleader = ',' "The default leader is \, but a comma is much better.
set number "Let's activate line numbers.
@m1r0
m1r0 / wp_insert_attachment_from_url.php
Last active April 11, 2024 12:33
WP: Insert attachment from URL
<?php
/**
* Insert an attachment from a URL address.
*
* @param string $url The URL address.
* @param int|null $parent_post_id The parent post ID (Optional).
* @return int|false The attachment ID on success. False on failure.
*/
function wp_insert_attachment_from_url( $url, $parent_post_id = null ) {
@Thinkscape
Thinkscape / SimpleXMLElement-node-existence.php
Last active June 11, 2021 02:53
How to check if a <child> node exists in SimpleXMLElement document ? Comparison of different approaches.
<?php
/**
* The only reliable way of determining if a child exists
* in SimpleXMLElement is to use count(). All other methods
* do not work reliably in global or local NS.
*
* NOTE: Error suppresion on @count() is used to suppress
* "PHP Warning: count(): Node no longer exists"
*/
if(!class_exists('SimpleXMLElement')) die("Bonkers");