Skip to content

Instantly share code, notes, and snippets.

View Skwerl's full-sized avatar

Kevin Cogill Skwerl

View GitHub Profile
@Skwerl
Skwerl / simple_flash_detect.js
Created November 28, 2012 18:42
One-line Flash Detection
//http://iamskwerl.com/tech/2012/11/flash-detection-with-one-line-of-javascript/
var hasFlash = navigator.mimeTypes && navigator.mimeTypes.length ? Array.prototype.slice.call(navigator.mimeTypes).some(function(a) { return "application/x-shockwave-flash" == a.type; }) : /MSIE/.test(navigator.userAgent) ? eval("try { new ActiveXObject('ShockwaveFlash.ShockwaveFlash') && !0 } catch(e) { !1 };") : !1;
<?php
$db = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_USER, DB_PASSWORD);
$data_error = false;
/* /////// PATIENT VARS ///////////////////////////////////////////////////////////////////////// */
$patient_dob = '10/08/05';
$patient_sex = 'male';
$patient_weight = '60';
@Skwerl
Skwerl / getRSSI()
Created September 23, 2013 02:01
this was almost giving me xbee rssi
byte getRSSI() {
// I'm only seeing 13 or 18... This function needs work.
union {byte B; char C;} atCmd[3];
AtCommandRequest atCmdReq;
AtCommandResponse atResp;
byte respLen, *resp, dBm;
strcpy(&atCmd[0].C, "DB");
@Skwerl
Skwerl / rseries_sparkfun.h
Last active December 29, 2015 22:49
Sparkfun MP3 Trigger via Serial TX2
int mp3Byte = 0;
boolean mp3Playing = false;
void setup() {
Serial2.begin(38400);
}
void loop() {
if (Serial2.available()) {
mp3Byte = Serial2.read();
// define variables
#define mp3RxPin 2
#define mp3TxPin 3
int volume = 255;
int mp3Byte = 0;
SoftwareSerial mp3Trigger = SoftwareSerial(mp3RxPin, mp3TxPin);
mp3Trigger.begin(38400);
// set volume
byte volbyte = map((volume-255), 0, 1023, 0, 255);
<?php
/* Lines 1682-1687, Version 1.5.0 */
if(in_array($f_key,array('sku','price','regular_price','sale_price'))){
$var_id=$item->get_variation_id();
if(!empty($var_id)){
$product=wc_get_product($var_id);
}
}