This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$discount_that_was_probably_applied = quick_calc_discount_used(1.21,10,11.99); | |
print_r($discount_that_was_probably_applied); | |
function quick_calc_discount_used($fixed = 0, $percent = 0, $sell_price) { | |
$gave_away = 0; | |
$method_used = false; | |
$final_sell = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// balls becomes an INT | |
$balls = 1; | |
// truthy check | |
if ($balls) { | |
$balls += 1; | |
} | |
// outputs: 2 | |
echo $balls; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// balls becomes an INT | |
$balls = 1; | |
// truthy check (any INTEGER > 0 will be true) | |
if ($balls) { | |
$balls += 1; | |
} | |
// truthy check: $balls is an INTEGER at this point | |
if ($balls) { | |
$balls = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// type a number on the serial commands | |
// zoomkat 10-22-11 serial servo test | |
// type servo position 0 to 180 in serial monitor | |
// or for writeMicroseconds, use a value like 1500 | |
// for IDE 0022 and later | |
// Powering a servo from the arduino usually *DOES NOT WORK*. | |
String readString; | |
#include <Servo.h> | |
Servo myservo; // create servo object to control a servo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TURN CLOCKWISE, WAIT A BIT, THEN GO ANTI CLOCK DEMO ONLY | |
#include <Servo.h> | |
#define TURN_TIME 1200 | |
Servo myservo; | |
void setup() { | |
myservo.attach(9); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
//start serial connection | |
Serial.begin(9600); | |
//configure pin 2 as an input and enable the internal pull-up resistor | |
pinMode(2, INPUT_PULLUP); | |
pinMode(13, OUTPUT); | |
} | |
void loop() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Servo.h> | |
#define TURN_TIME 1200 | |
Servo toolheadServo; | |
int toolheadHome = 0; | |
boolean toolheadGoingHome = false; | |
int discContact = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
from platform import system as platform_name | |
from os import system | |
import ctypes | |
platforms_dictionary = { | |
"Windows": { # | |
"open" : 'ctypes.windll.WINMM.mciSendStringW(u"open L: type CDAudio alias L_drive", None, 0, None); ctypes.windll.WINMM.mciSendStringW(u"set L_drive door open", None, 0, None)', | |
"close": 'ctypes.windll.WINMM.mciSendStringW(u"open L: type CDAudio alias L_drive", None, 0, None); ctypes.windll.WINMM.mciSendStringW(u"set L_drive door closed", None, 0, None)' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PoliceMan: | |
def __init__(self, health, attack, speed): | |
self.health = health | |
self.attack = attack | |
self.speed = speed | |
self.name = 'PoliceManDEPT101' | |
# slow fat one has 100 hp, 10 attack, and moves at 25 speed | |
SlowFatOne = PoliceMan(100.00,10.00,25.00) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// i cant remember where wp-plugins live, lets assume we want everything from the level above? | |
$output = shell_exec('scp -r ../ [email protected]:/some/remote/directory/bar'); | |
// Display the scp output | |
echo "<pre>$output</pre>"; | |
?> |