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
/** | |
* Fancy ID generator that creates 20-character string identifiers with the following properties: | |
* | |
* 1. They're based on timestamp so that they sort *after* any existing ids. | |
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
* latter ones will sort after the former ones. We do this by using the previous random bits | |
* but "incrementing" them by 1 (only in the case of a timestamp collision). | |
*/ |
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
// in Start() of "(Unity Project path)\Library\PackageCache\[email protected]\Runtime\2D\ShadowCaster2D.cs" | |
// have replace it with this: | |
private void Awake() { | |
if(m_ApplyToSortingLayers == null) | |
m_ApplyToSortingLayers = SetDefaultSortingLayers(); | |
Bounds bounds = new Bounds(transform.position, Vector3.one); | |
Renderer renderer = GetComponent<Renderer>(); | |
if (renderer != null) | |
{ |
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
# prevents local database from being uploaded | |
*.mdf | |
# prevents addition of .txt files | |
*.txt | |
# trash | |
**/.trash/ | |
## Ignore Visual Studio temporary files, build results, and | |
## files generated by popular Visual Studio add-ons. | |
# User-specific files |
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
int lastMouseBtnStateLeft = GLUT_UP; // last left mouse buttons state | |
int lastMouseBtnStateRight = GLUT_UP; // last right mouse buttons state | |
void processMouse(int button, int state1, int x, int y){ | |
if (button == GLUT_LEFT_BUTTON) { | |
// decode and handle the mouse events by type | |
if ((lastMouseBtnStateLeft == GLUT_UP )&&(state1 == GLUT_DOWN)) // mouse down (click) | |
{ | |
// here do your stuff | |
} | |
if ((lastMouseBtnStateLeft == GLUT_DOWN)&&(state1 == GLUT_DOWN)) // mouse move while clicked |
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
#ifndef CRAFTEDSTRINGCONVERTER_H | |
#define CRAFTEDSTRINGCONVERTER_H | |
#include <codecvt> // converter | |
#include <string> | |
#include <Windows.h> | |
#include <tchar.h> // WCHAR and wchar_t | |
#include <stdlib.h> // mbstowcs_s | |
#include <cstring> // strlen | |
#include <iostream> // cout endl | |
using std::string; using std::wstring; |
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
/** | |
* This function sets the image into the imageView. | |
*/ | |
public void setBitmapFromNetwork(){ | |
Runnable runnable = new Runnable() { | |
Bitmap bitmap = null; | |
@Override | |
public void run() { |
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 <iostream> | |
#include <conio.h> | |
#include <windows.h> | |
using namespace std; | |
class PasswordInput | |
{ | |
private: | |
string password; /* The string to store the password */ |
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
//original source: https://stackoverflow.com/questions/1413445/reading-a-password-from-stdcin | |
#ifdef WIN32 | |
#include <windows.h> | |
#else | |
#include <termios.h> | |
#include <unistd.h> | |
#endif | |
void SetStdinEcho(bool enable = 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
// | |
//---Insertion Sort - Sorts the data by pairs then checks j from those behind it---// | |
//--- Link: http://cforbeginners.com/insertionsort.html ---// | |
// | |
void insertion_sort (int arr[], int length){ | |
int j, temp; | |
for (int i = 1; i < length; i++){ | |
j = i; | |
while (j > 0 && arr[j] < arr[j-1]){ | |
temp = arr[j]; |