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
D3DXVECTOR3 CPR_Player::GetNewDirFromInput() | |
{ | |
D3DXVECTOR3 newDir; | |
D3DXVECTOR2 deltaMousePos = ( GetMousePosition() - m_startMousePos ); | |
deltaMousePos.x *= MOUSE_SENSITIVITY; | |
deltaMousePos.y *= MOUSE_SENSITIVITY; | |
deltaMousePos.x = ( abs( deltaMousePos.x ) > MOUSE_THRESHOLD ) ? deltaMousePos.x : 0.0f; | |
deltaMousePos.y = ( abs( deltaMousePos.y ) > MOUSE_THRESHOLD ) ? deltaMousePos.y : 0.0f; | |
deltaMousePos.y = CLAMP( deltaMousePos.y, D3DXToRadian( -89.9f ), D3DXToRadian( 89.9f ) ); |
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
// https://www.geeksforgeeks.org/extract-integers-string-c/ | |
vector<int> extractIntegerWords(string str) | |
{ | |
vector<int> v; | |
stringstream ss; | |
/* Storing the whole string into string stream */ | |
ss << str; | |
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<bits/stdc++.h> | |
using namespace std; | |
// Greedy Algorithm | |
// https://en.wikipedia.org/wiki/Activity_selection_problem | |
struct Workshop | |
{ | |
Workshop( int s, int d ) : start_time( s ), duration( d ), end_time( s + d ) {} |
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
// | |
// a[0] = S (modulo 2^31) | |
// for i = 1 to N-1 | |
// a[i] = a[i-1]*P+Q (modulo 2^31) | |
// | |
// https://www.hackerrank.com/challenges/bitset-1/forum/comments/138875 | |
#include <algorithm> | |
#include <iostream> |
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
// http://kevinushey.github.io/blog/2016/01/27/introduction-to-c++-variadic-templates/ | |
// https://en.cppreference.com/w/cpp/language/parameter_pack | |
// https://www.hackerrank.com/challenges/cpp-variadics/problem | |
#include <iostream> | |
using namespace std; | |
template <bool a> | |
int reversed_binary_value() | |
{ |
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
// https://www.geeksforgeeks.org/sliding-window-maximum-maximum-of-all-subarrays-of-size-k/ | |
// A Dequeue (Double ended queue) based method for printing maixmum element of | |
// all subarrays of size k | |
void printKMax(int arr[], int n, int k) | |
{ | |
// Create a Double Ended Queue, Qi that will store indexes of array elements | |
// The queue will store indexes of useful elements in every window and it will | |
// maintain decreasing order of values from front to rear in Qi, i.e., | |
// arr[Qi.front[]] to arr[Qi.rear()] are sorted in decreasing order |
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
// https://www.techiedelight.com/longest-common-subsequence/ | |
int LCS( string X, string Y ) | |
{ | |
int m = X.length(), n = Y.length(); | |
// lookup table stores solution to already computed sub-problems | |
// i.e. lookup[i][j] stores the length of LCS of substring | |
// X[0..i-1] and Y[0..j-1] | |
int lookup[m + 1][n + 1]; |
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
import os | |
from pydub import AudioSegment // https://github.com/jiaaro/pydub | |
source_dir = "C:\Users\schoe\Desktop\Jukebox\source\\" | |
destination_dir = "C:\Users\schoe\Desktop\Jukebox\destination\\" | |
for file in os.listdir(source_dir): | |
milliseconds = 10*1000 | |
print( "split \"" + file + "\" from " + source_dir + " into " + destination_dir + " by " + "{:,}".format( milliseconds / 1000 ) + " seconds." ) |
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 PI 3.14159265 | |
degree = radian * 180 / PI; |
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
////////////////////////////////////////////////////////////////////////////////////////// | |
// Display the gamepad buttons in the editor with XBox or PS4 names | |
////////////////////////////////////////////////////////////////////////////////////////// | |
UEditorExperimentalSettings > TEnumAsByte < EConsoleForGamepadLabels::Type > ConsoleForGamepadLabels // Specify which console-specific nomenclature to use for gamepad label text | |
////////////////////////////////////////////////////////////////////////////////////////// | |
// Character Cheat-sheet | |
////////////////////////////////////////////////////////////////////////////////////////// |