Skip to content

Instantly share code, notes, and snippets.

# Function to print the current state of the board
def print_board(board):
# Iterate over the board in steps of 3 to print each row
for i in range(1, 10, 3):
# Print the current row of the board with corresponding values
print(f"{i}: {board[i]} {i+1}: {board[i+1]} {i+2}: {board[i+2]}\n")
# Function to check if there's a winner
def check_win(board):
# Define all possible winning combinations
# Function to print the current state of the board
def print_board(board):
# Iterate over the board in steps of 3 to print each row
for i in range(1, 10, 3):
# Print the current row of the board with corresponding values
print(f"{i}: {board[i]} {i+1}: {board[i+1]} {i+2}: {board[i+2]}\n")
# Function to check if there's a winner
def check_win(board):
# Define all possible winning combinations
<?php
/**
* @copyright Copyright (c) PutYourLightsOn
*/
/**
* Blitz config.php
*
* This file exists only as a template for the Blitz settings.
@keyurshah
keyurshah / boost.unpoly.js
Created June 5, 2020 17:14 — forked from johndwells/boost.unpoly.js
Automatically pass all same-domain links through unpoly.js
// Automatically bind internal links to `up-follow` behaviour
// Unpoly will already catch and handle links with explicit `up-follow` etc,
// so we are safe to assume that if our handler below is triggered, the link
// doesn't already have an up- attribute.
//
// Scenarios to handle:
// Hat-tip to https://github.com/instantpage/instant.page/blob/master/instantpage.js
// ✅ cmd+click
// ✅ empty links
// ✅ links to another domain
@keyurshah
keyurshah / trix.blade.php
Created May 15, 2020 13:43 — forked from tanthammar/trix.blade.php
Livewire trix input
@push('body-styles')
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/trix/1.2.0/trix.css">
@endpush
<form>
<input x-ref="description" id="description" name="description" value='{{ $description }}' type="hidden" />
<div wire:ignore>
<trix-editor input="description"></trix-editor>
</div>
@keyurshah
keyurshah / LivewireSortable.php
Created May 15, 2020 13:42 — forked from tanthammar/LivewireSortable.php
Livewire Sortable fix with array form
<?php
namespace App\Http\Livewire\App\Organizers\Forms;
use App\Http\Livewire\Traits\Form;
use App\Models\Organizer;
use Livewire\Component;
class People extends Component
{
@keyurshah
keyurshah / test.log
Created January 15, 2020 04:22
AlpineJS Errors
FAIL test/lifecycle.spec.js
● callbacks registered within x-created can affect reactive data changes
expect(received).toEqual(expected) // deep equality
Expected: "baz"
Received: undefined
51 | Alpine.start()
52 |
@keyurshah
keyurshah / alt-tab.ahk
Created November 27, 2019 16:31
autototkey alt tab
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
$\::Send, {ALT DOWN}{TAB}{ALT UP} ;\ to switch to last window
$!\::Send \ ;alt+\ to type \
$+!\::Send | ;shift+alt+\ to type |
@keyurshah
keyurshah / routes.php
Created October 18, 2019 13:23 — forked from tommymarshall/routes.php
Simple Laravel + Craft integration
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
a
about
an
are
as
at
be
by
com
de