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 <QApplication> | |
#include <QMainWindow> | |
#include <QTextEdit> | |
#include <QLineEdit> | |
#include <QPushButton> | |
#include <QVBoxLayout> | |
#include <QWidget> | |
#include <QString> | |
#include <QScrollBar> |
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 <windows.h> | |
#include <string> | |
#include <vector> | |
#include <algorithm> | |
#include <cctype> | |
#include <CommCtrl.h> | |
#pragma comment(lib, "Comctl32.lib") | |
#pragma comment(linker,"\"/manifestdependency:type='win32' \ | |
name='Microsoft.Windows.Common-Controls' version='6.0.0.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
#include <windows.h> | |
#include <string> | |
#include <vector> | |
#include <algorithm> | |
#include <cctype> | |
// Window procedure declaration | |
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); | |
// Global variables |
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
from shapely.geometry import LineString | |
import matplotlib.pyplot as plt | |
# Given points | |
points = [(5, 0), (10, 20), (20, 20), (20, 30), (30, 30), (30, 10), (5, 0)] | |
# Distance threshold | |
D = 5 | |
line = LineString(points) |
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
use itertools::Itertools; | |
use std::slice::IterMut; | |
fn foo(s0: &mut String, s1: &mut String, s2: &mut String) { | |
s0.push_str("!"); | |
s1.push_str("!!"); | |
s2.push_str("!!!"); | |
} | |
struct MutIterator<'a, 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
pub fn is_valid_hack(s: &str) -> bool { | |
if s.len() % 2 == 1 { | |
return false; | |
} | |
let mut par: Vec<char> = Vec::new(); | |
for c in s.chars() { | |
let 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
pub fn is_valid(s: &str) -> bool { | |
if s.len() % 2 == 1 { | |
return false; | |
} | |
let closing = vec![')', ']', '}']; | |
let opening = vec!['(', '[', '{']; | |
let mut par: Vec<char> = Vec::with_capacity(s.len()); |
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
pub fn is_valid(s: String) -> bool { | |
if s.len() % 2 == 1 { | |
return false; | |
} | |
let mut brackets = HashMap::new(); | |
brackets.insert(')', '('); | |
brackets.insert(']', '['); | |
brackets.insert('}', '{'); |
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
fn bottles(n: u32) -> String { | |
if n > 1 { | |
format!("{} bottles", n) | |
} else if n == 1 { | |
"1 bottle".to_string() | |
} else { | |
"no more bottles".to_string() | |
} | |
} |
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 RWLock : IDisposable | |
{ | |
public struct WriteLockToken : IDisposable | |
{ | |
private readonly ReaderWriterLockSlim @lock; | |
public WriteLockToken(ReaderWriterLockSlim @lock) | |
{ | |
this.@lock = @lock; | |
@lock.EnterWriteLock(); | |
} |
NewerOlder