This file contains 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 fillGlobalVariables() | |
{ | |
double temp_double; | |
float temp_float = 0f; | |
int temp_int; | |
char c; | |
... | |
while() | |
{ | |
c = serial_read(...); //receive one byte from serial port and put it into c |
This file contains 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
private void swap(ref int lhs, ref int rhs) | |
{ | |
int temp = lhs; | |
lhs = rhs; | |
rhs = temp; | |
} |
This file contains 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 some_function() | |
{ | |
float temp_a; | |
float temp_b; | |
float temp_c; | |
//please, kill me | |
... | |
} |
This file contains 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.Generic; | |
public sealed class Pair<T1, T2> : IEquatable<Pair<T1, T2>> | |
{ | |
/* | |
USAGE: | |
Pair<int, string> myPair = new Pair<int, string>(4, "asd"); | |
Pair<int, string> mySecondPair = new Pair<int, string>(4, "asd"); | |
Pair<int, string> myThirdPair = new Pair<int, string>(4, "asdsds"); |
This file contains 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
import random | |
import time | |
while True: | |
randomInt = random.randint(0,100) | |
randomNormalized = random.random() | |
caseLessThenHalf = (randomNormalized < 0.5) | |
caseEven = ((randomInt % 2) == 0) | |
caseMoreThanTen = (randomInt > 10) | |
This file contains 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
import random | |
import time | |
caseCounter = 0 | |
randomInt = random.randint(0,100) | |
randomNormalized = random.random() | |
caseLessThenHalf = (randomNormalized < 0.5) | |
caseEven = ((randomInt % 2) == 0) | |
caseMoreThanTen = (randomInt > 10) |
This file contains 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.Generic; | |
using System.ComponentModel; | |
using System.Windows.Forms; | |
namespace testAdvanced | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
This file contains 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.Drawing; | |
using System.Windows.Forms; | |
namespace BejeweledBot | |
{ | |
class OverlayForm : Form | |
{ | |
private int X { get; set; } | |
private int Y { get; set; } | |
private bool isDragged = false; |
This file contains 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
private void setTilesColors(Bitmap bmp) | |
{ | |
int offset = TileWidth / 3; | |
for (int row = 0; row < boardRows; row++) | |
for(int col = 0; col < boardColumns; col++) | |
{ | |
int x = corner.X + row * TileWidth + offset; | |
int y = corner.Y + col * TileWidth + offset; | |
Rectangle cloneRect = new Rectangle(x, y, TileWidth - 2 * offset, TileWidth - 2 * offset); | |
PixelFormat format = bmp.PixelFormat; |
This file contains 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
static class ScreenCap | |
{ | |
public static Bitmap Grab(Rectangle rect) | |
{ | |
Bitmap bmp = new Bitmap(rect.Width, rect.Height); | |
using (Graphics g = Graphics.FromImage(bmp)) | |
{ | |
g.CopyFromScreen(rect.X, | |
rect.Y, | |
0, 0, |
OlderNewer