Skip to content

Instantly share code, notes, and snippets.

View dengsauve's full-sized avatar
:octocat:
How much firepower is necessary to imbed a cherry in an acoustic ceiling tile?

Dennis Sauve dengsauve

:octocat:
How much firepower is necessary to imbed a cherry in an acoustic ceiling tile?
View GitHub Profile
@dengsauve
dengsauve / ImpersonateUser.php
Created May 15, 2019 00:33
Laravel User Impersonation
<?php
namespace App\Nova\Actions;
use Illuminate\Bus\Queueable;
use Laravel\Nova\Actions\Action;
use Illuminate\Support\Collection;
use Laravel\Nova\Fields\ActionFields;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@dengsauve
dengsauve / no_curl_post.php
Created January 28, 2019 20:51
PHP Curl-less POST request
$url = 'http://server.com/path';
$data = array('key1' => 'value1', 'key2' => 'value2');
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
@dengsauve
dengsauve / install.sh
Created July 31, 2018 23:37
Discord Bot Starter Setup
echo "Installing Discord Bot Basics"
echo "Creating Auth file"
touch auth.json
echo -e '{
\t"token":""
}' >> auth.json
echo "Creating node.js package file"
touch package.json
@dengsauve
dengsauve / index.html
Created July 12, 2018 00:47
Default template for Bootstrap 4.1
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
@dengsauve
dengsauve / histogram.rb
Created July 10, 2018 23:26
One Line Ruby Historgram
############################################################
#
# Name: Dennis Sauve
# Date: 01/30/17
# Assignment: Histogram
# Class: CIS282
# Description: Histogram Assignment
#
############################################################
@dengsauve
dengsauve / panel-height.css
Created April 12, 2018 18:18
Bootstrap Panels Equal Height in Row
@media screen and (min-width: 768px) {
/* Class defining .panel container row */
.panel-uniform-height {
display: flex;
}
/* Regardless of content, panels will of be equal height */
.panel-uniform-height .panel{
height: 100%;
@dengsauve
dengsauve / ClosestString.rb
Created March 11, 2018 12:01
Solution to Daily Programmer Challenge #353 [Easy] Closest String
# Challenge #353 [Easy] Closest String
# Objective: Given n number of strings, find the string that is the 'Geometric Center' by Hamming Distance
# Approach: Iterate through strings in order and compare, adding the differences between string a and b to their respective totals
# Note: Storing the differences for both at the same time reduces the number of comparisons performed.
def find_hamming_center(input)
input_array = input.split("\n")
num_str = input_array.slice!(0).to_i
diff_arr = Array.new(num_str, 0)# <- array to store sum of differences for each string
@dengsauve
dengsauve / make_roman_numeral_test.rb
Created February 26, 2018 22:35
Ruby Integer to Roman Number TDD, test builder file using assignment (requires 'to_words' gem).
require 'to_words'
require_relative 'roman.rb'
100.times do |n|
# make the test def
puts "def test_#{n}s" if n % 10 == 0
# print the assertions
puts "\tassert_equal( \"#{n.to_roman}\", #{n}.to_roman, \"#{n.to_words.upcase}\")"
@dengsauve
dengsauve / Bootstrap 3.3 Form Generator.rb
Last active January 14, 2018 22:11
Bootstrap 3.3 HTML Form Generator
# Bootstrap 3.3 HTML form Generator
def get_form_meta()
# Ask user for the form helper_method
puts "What method are you using for your form?"
form_method = gets.chomp!
# Ask user for the form method
puts "\nWhat action is the form performing? "
form_action = gets.chomp!
@dengsauve
dengsauve / Main.java
Created January 4, 2018 18:30
Java Class Code
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int counter = 1;
while(counter<5){
System.out.println("Hello World!");
System.out.println("Hello Dennis!");