Skip to content

Instantly share code, notes, and snippets.

View AdamZWinter's full-sized avatar

Adam Winter AdamZWinter

  • Seattle, WA, USA
View GitHub Profile
@AdamZWinter
AdamZWinter / gist:c4b382e142aa67698ce0ef5f20ff6867
Created November 13, 2023 04:57
Singleton Object Class Java
public class BandRepository {
private static BandRepository instance;
private List<Band> mBands;
public static BandRepository getInstance(Context context) {
if (instance == null) {
instance = new BandRepository(context);
}
return instance;
@AdamZWinter
AdamZWinter / gist:03c5b4931cac20f3dc94604fcce51f90
Last active March 16, 2021 17:21
Powershell Password Credentials to String
#Prompts for the username/password, enter the username in the form of DomainName\UserName
$Credential = get-credential -Message "Please enter the VPM credentials"
#Converts the password to clear text to pass it through correctly as passing through a secure string does not work.
$Password = $credential.GetNetworkCredential().password
#Converts the $Credential to just the DomainName/UsernName.
$Account = $credential.UserName
echo $Password
/*
:root {
--myPurple: 8, 0, 24;
--purpleButton: 25, 0, 75;
--offWhite: 195, 210, 190, 1;
--backGrey: 40, 40, 40;
--linkBlue: 195, 210, 255, 1;
}
*/
#! /usr/bin/env python2.7
import json
import glob
import copy
producers = []
for filename in glob.glob('new/*.json'):
fileobj = open(filename, "r")
<?php
echo '
<table width=50%>
<thead>
<tr>
<th width=60%><p>Name</p></th>
<th width=20%><p>Owner</p></th>
<th width=20%><p>Permission</p></th>
</tr>
<?php
$oldString ='version 4.4.6 ( updated 05-08-2020 )
- Improved logic to keep collapse/expand state consistent for Add/Clone/Delete/DnD actions in Layers panel.
- Updated Layers panel to allow selecting Goal and Winner for Split Testing from Layers panel.
- Improved the Visual Builder scroll performance.
- Added vmin and vmax to css allowed units in module settings.
version 4.4.5 ( updated 05-01-2020 )
- Improved logic to keep collapse/expand state consistent for Add/Clone/Delete/DnD actions in Layers panel.
- Updated Layers panel to allow selecting Goal and Winner for Split Testing from Layers panel.
@AdamZWinter
AdamZWinter / PHP_eval.gist
Created June 6, 2020 06:34
Evaluating math expressions written as strings
echo '<p>';
function evaluate_everything($values, $expressions) {
$output = [];
foreach($expressions as $expression) {
$row = [];
foreach($values as $value){
$str = '';
eval("\$str = \"$expression\";");
@AdamZWinter
AdamZWinter / PHP MySQL database table to HTML table
Created June 5, 2020 18:28
Common steps for displaying database table.
<?php
require('/var/www/html/.../header.php');
$active = 'yes';
$query = "SELECT * FROM calendars WHERE active = ?";
$stmt = $db->prepare($query);
$stmt->bind_param('s', $active);
$stmt->execute();
$result = $stmt->get_result();
<div id="formInputs">
<p>
<input type="text" name="email" id="email" style="width:67%;" placeholder="Email*"/>
<input type="password" name="password" id="password" style="width:67%;" placeholder="Password*"/>
</p>
<button id="reviewButton" onclick="login()" class="buttonLogin">Log In</button>
</div>
<div id="for-logged-in-user-only" style="display:none;"></div>
// buffer all upcoming output
ob_start();
echo 'All done. Goodbye.';
// get the size of the output
$size = ob_get_length();
// send headers to tell the browser to close the connection
header("Content-Length: $size");
header('Connection: close');