Skip to content

Instantly share code, notes, and snippets.

Avatar

Rhys Williams rrrhys

View GitHub Profile
View gist:d23d3fb59618ac3f2fd91dd641370f97

Before start, we radio ground and request start and taxi for circuits. Have to request start in this case in case circuits are full. He will give clearance to start or start and taxi.

After start, we request clearance to taxi. Since we were on runway 24, we taxi'd to ECHO. We know where ECHO is because it runs L to R down the runway from 6.

Do the run-up etc, taxi to echo, stop, get clearance for circuits, enter runway.

Full throttle, no flaps, manage runway yaw with rudder until 60kt. Then slight back pressure to lift nose (in the 172N, the 172S just goes anyway)

Establish best rate, 74kt. Continue climb at best rate. (At 300ft, do some sanity checks - forgot acronym, trim for best rate)

View PHP Image Reverse Proxy
Route::get('/external_resource', function(\Illuminate\Http\Request $request){
$resource = $request->get("resource");
$options = array('http' => array('user_agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'));
$context = stream_context_create($options);
$f = file_get_contents($resource, false, $context);
$finfo = new finfo(FILEINFO_MIME);
@rrrhys
rrrhys / DebuggerCheck.ts
Created Sep 28, 2018
Check if the debugger is attached in a React Native project.
View DebuggerCheck.ts
// setTimeout (and other wait related code) fails when a debugger is attached to React Native.
// in DebuggerCheck.ts
let _looksLikeDebuggerAttached = true;
setTimeout(() => {
_looksLikeDebuggerAttached = false;
}, 1);
export default {
debuggerIsAttached: () => {
@rrrhys
rrrhys / addTabsToText.js
Created Aug 24, 2018
Add tabstops to a body of text (React Native *does not* render tabs.
View addTabsToText.js
private repairBrokenTabs(text: string) {
let newLine = "\n";
let textLines = text.split(newLine);
let tabStop = 10;
let spaceString = Array(tabStop+1).join(" "); //
for (let l = 0; l < textLines.length; l++) {
let line = textLines[l];
while (line.indexOf("\t") > -1) {
let tabPos = line.indexOf("\t");
let modulo = tabStop - (tabPos % tabStop);
View Lifetime discount for customer - WooCommerce
select pm_cust.meta_value as user_id, sum(pm_disc.meta_value) as disc_total
from wp_postmeta pm_cust
inner join wp_postmeta pm_disc
on pm_disc.post_id = pm_cust.post_id and pm_disc.meta_key = '_cart_discount'
where pm_cust.meta_key = '_customer_user' and pm_cust.meta_value = 8;
View Example of VQMOD usage
<modification>
<id>Tell Afterpay when shipped.</id>
<version>1.0.0</version>
<vqmver>2.5.1</vqmver>
<author>Rhys Williams</author>
<email>rwilliams@codeworkshop.com.au</email>
<website>www.codeworkshop.com.au</website>
<file name="catalog/model/checkout/order.php">
<operation>
View FormattedDbEntityValidationException.cs
public class FormattedDbEntityValidationException : Exception
{
public FormattedDbEntityValidationException(DbEntityValidationException innerException) :
base(null, innerException)
{
}
public override string Message
{
get
@rrrhys
rrrhys / Client side function
Created Jun 16, 2015
Reset iOS badge to zero by installationId - parse.com and javascript
View Client side function
Parse.Cloud.run("resetBadge", {
installationId: installationId
});
@rrrhys
rrrhys / gist:485b16b542608ce2054e
Created Jan 12, 2015
Quick and easy readable -> mysql UTC -> readable again
View gist:485b16b542608ce2054e
User chooses date and time in picker.
Post to server:
var mom = moment(date).utc().format("YYYY-MM-DD HH:mm:ss");
$.post("/endpoint", {time: mom}, function(obj){
if(typeof(obj) != "object"){
obj = $.parseJSON(obj);
}
View handleUpload.php
<?php // You need to add server side validation and better error handling here
$data = array();
if(isset($_FILES))
{
$error = false;
$files = array();
$uploaddir = './uploads/';