Skip to content

Instantly share code, notes, and snippets.

View mikestratton's full-sized avatar

Mike Stratton mikestratton

View GitHub Profile
@mikestratton
mikestratton / lottery.php
Created January 12, 2016 08:52
Lottery algorithm based on Benford's Law that will make your rich!
<html>
<head>
<title>Lottery & Benfords Law</title>
</head>
<body style="margin:2% auto; text-align:center;">
<h1>Win the Lottery Using Benford's Law!</h1>
<p>This PHP page uses Benford's law to randomly generates numbers for the Powerball Lottery<br />
<a href="https://en.wikipedia.org/wiki/Benford%27s_law" target="_blank">Click here to learn more about Beford's Law<a/></p>
<h3>This generator increases your chances to win by approximately 30% !</h3>
<?php
@mikestratton
mikestratton / save2JSON.php
Last active November 23, 2022 00:15
Save form data in JSON file.
<?php
if(isset($_POST['submit'])) {
$file = "data.json";
$arr = array(
'name' => $_POST['name'],
'email' => $_POST['email'],
'phone' => $_POST['cell'],
'birthday' => $_POST['dob'],
'years' => $_POST['study']
);
@mikestratton
mikestratton / word-search.php
Created March 4, 2022 03:11
Incomplete solution for Leetcode Word Search
<?php
// https://leetcode.com/problems/word-search/
function exist($board, $word) {
// count width
$x = count($board[0]);
// count height
$y = 0;
@mikestratton
mikestratton / BusinessProfileController.php
Created January 17, 2022 08:41
GIS Function within Laravel Controller
public function geoCoding($zip_code){
$api = 'https://maps.googleapis.com/maps/api/geocode/json?address=';
$par = '&key=';
$goo = env('GOOGLE_KEY');
$url = $api . $zip_code . $par . $goo;
$file = file_get_contents($url);
$json = json_decode($file, true);
$lat = $json['results'][0]['geometry']['location']['lat'];
public function store(DefinitionsCreateRequest $request)
{
$input = $request->all();
$input['surveyor_id'] = Auth::id();
$quantity = $request->input('quantity');
$samples = 0;
if($quantity <= 999){
$samples = 3;
@mikestratton
mikestratton / freecodecamp-pomodoro-clock.markdown
Created February 16, 2021 01:54
freeCodeCamp: Pomodoro Clock

freeCodeCamp: Pomodoro Clock

Objective: Build a CodePen.io app that is functionally similar to this: https://codepen.io/FreeCodeCamp/full/aNyxXR/.

Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.

  • User Story: I can start a 25 minute pomodoro, and the timer will go off once 25 minutes has elapsed.
  • User Story: I can reset the clock for my next pomodoro.
  • User Story: I can customize the length of each pomodoro.

A Pen by Mike Stratton on CodePen.

@mikestratton
mikestratton / index.html
Created November 1, 2019 07:10
Simonwep pickr, Bind with input
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@simonwep/pickr/dist/themes/nano.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@simonwep/pickr/dist/pickr.es5.min.js"></script>
</head>
<body>
@mikestratton
mikestratton / vim_cheatsheet.md
Created September 20, 2019 05:02 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
<?php
namespace App\Http\Controllers;
use App\Floor;
use App\Location;
use App\Photo;
use App\Property;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
<?php
//MySQL Database Connect
include 'dataconnect.php';
$wp_posts = "wp_posts";
$sql = "SELECT * FROM " . $wp_posts;
$result = $conn->query($sql);
if ($result->num_rows > 0) {