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 <Adafruit_Thermal.h> | |
#include <SoftwareSerial.h> | |
#define PRINTER_RX 12 | |
#define PRINTER_TX 13 | |
#define SERIAL_BAUD 9600 | |
Adafruit_Thermal printer(PRINTER_RX, PRINTER_TX); | |
boolean stringComplete = false; |
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
double invokeCalculator(id object, SEL method, double price, double extraItemPrice, int index) { | |
double returnValue = 0xDEAD; | |
if([object respondsToSelector:method]) { | |
NSLog(@"object responded sucessfully"); | |
NSInvocation* invocation = | |
[NSInvocation invocationWithMethodSignature: [object methodSignatureForSelector: method]]; | |
[invocation setTarget: object]; // index 0 | |
[invocation setSelector: method]; // index 1 | |
[invocation setArgument: &price atIndex: 2]; // index 2 |
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
var slaying = true; | |
var youHit = function() { | |
return Math.round(Math.random()); | |
}; | |
var damageThisRound = 0; | |
var damage = function(min, max) { | |
return Math.floor(Math.random() * max + min); | |
}; |
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
public class ConsList<T extends Comparable<T>> { | |
private T _head; | |
private ConsList<T> _tail; | |
public ConsList(T head, ConsList<T> tail) { | |
_head = head; | |
_tail = tail; | |
} | |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 | |
{ | |
class ConsList<T> : IEnumerable where T : IComparable<T> |
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
// credit for this goes to makerofthings7 on stack exchange | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
using System.Net; |
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
#define CLOCK_PIN 2 | |
#define LATCH_PIN 3 | |
#define DATA_PIN 4 | |
#define OPEN_LATCH digitalWrite(LATCH_PIN, 0) | |
#define CLOSE_LATCH digitalWrite(LATCH_PIN, 1) | |
byte digits[16]; | |
void setup() { | |
pinMode(LATCH_PIN, OUTPUT); |
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
#define CLOCK_PIN 2 | |
#define LATCH_PIN 3 | |
#define DATA_PIN 4 | |
#define READ_PIN 0 | |
#define OPEN_LATCH digitalWrite(LATCH_PIN, 0) | |
#define CLOSE_LATCH digitalWrite(LATCH_PIN, 1) | |
byte digits[16]; | |
void setup() { |
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
def attempt[T,E <: Exception](attempts: Int, subject: String, failedMessage: String, exception: E, failCondition: T => Boolean)(body: => T): T = { | |
val i = body | |
if(failCondition(i) && attempts != 0) { | |
println(s"Subject: $subject") | |
println(s"Message: $failedMessage") | |
println(s"Attempts left: $attempts") | |
// do something with the exception | |
attempt(attempts - 1, subject, failedMessage, exception, failCondition)(body) | |
} | |
else i |
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
package com.wausoft.main | |
import scala.collection.mutable.Stack | |
trait ImplicitClasses { | |
implicit class RichStack[A](stack: Stack[A]) { | |
def operate(op: (A, A) => A): Unit = { | |
val (b, a) = (stack.pop, stack.pop) | |
stack push op(a,b) | |
} |
OlderNewer