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
# Simplistic example using send_file to send the contents generated in the service | |
@app.route("/vcard/<href_token>") | |
def get_person_vcard(request: requests.HTTPRequest, href_token: str): | |
vcard_stream = self.vcard_service.get_vcard(b64decode(href_token.encode('UTF-8')).decode('UTF-8')) | |
return send_file(vcard_stream, mimetype='text/vcard') |
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 do_work(int* c) { | |
int i*; // This is never defined, and its value cannot be guaranteed. | |
int j = 42; // This is never used, but the programmer likely intended for it to be. | |
return c + *i; // Because i is never defined, this will likely be incorrect. | |
} |
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 reverse(string): | |
return string[::-1] | |
def concat(*strings): | |
return "".join(strings) | |
def create_factory(obj, *args, **kwargs): | |
def factory(*oargs, **okwargs): |
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 <cstring> | |
using namespace std; | |
int main() { | |
const char* foo = "✓"; | |
const char* foo2 = "\xe2\x9c\x93"; | |
const char* bar = "é"; | |
const char* baz = "a"; |
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 <vector> | |
#include <cstring> | |
#include <cstdlib> | |
#include <string> | |
#define PACKING_DELIMITER 999999 | |
void tokenize(const char* input) | |
{ |
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 main() { | |
std::string foostring = "this is a test [[6379]] of the number finding system."; | |
auto digstart = foostring.find_first_of("1234567890"); | |
auto tail = foostring.substr(digstart); | |
auto digend = tail.find_first_not_of("1234567890"); | |
auto digit = tail.substr(0,digend); | |
auto digint = atoi(digit.c_str()); | |
std::cout << digint << std::endl; | |
return 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
// Store as a const char* to avoid having to convert back and forth while | |
// we suss out which tokens are integers. | |
const char* inputString = redisRepy->str; | |
int len = strlen(inputString); | |
int strIndex = 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
def integral_to_script(self, original_integral): | |
""" | |
Converts integral commands to human-readable MoguScript. | |
For instance, "2 58 foo 6 26 58 bar 6" would be translated to: | |
'set widget foo content to widget bar content' | |
However, there can be contextual | |
differences which may need to be set up, because some integral | |
representations have multiple textual representations i | |
(content|contents|text, for instance). | |
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
# Tom A. Thorogood - 2013 - github.com/tomthorogood | |
# | |
# This software is free to use, modify, and distribute as you wish. It is intended for educational purposes only, and is | |
# provided without a guarantee of functionality or warranty of any sort. Usage is solely at your own risk. | |
# | |
# The Euler provides a method to estimate the value of a function (f) given an input value (x). | |
# | |
# The class requires the following: | |
# 1) An equation with two variables (x and y) | |
# 2) A known x, and known y 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
#include <iostream> | |
#include <string> | |
using std::cout; | |
using std::endl; | |
using std::string; | |
int main() { | |
string var1 = "butt"; | |
string var2 = "soap"; |
NewerOlder