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
#include <iostream> | |
using namespace std; | |
struct A { | |
// Use this to wrap method from a derived class | |
template <typename Class, void (Class::*method)()> | |
void makeCall() { | |
(dynamic_cast<Class*>(this)->*method)(); | |
} |
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
// https://stackoverflow.com/a/60505243/4952028 | |
function hexToUtf8(s) | |
{ | |
return decodeURIComponent( | |
s.replace(/\s+/g, '') // remove spaces | |
.replace(/[0-9a-f]{2}/g, '%$&') // add '%' before each 2 characters | |
); | |
} |
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
<script src="http://cdn.jsdelivr.net/g/filesaver.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/exceljs.min.js" integrity="sha256-wJUdjGj95YIQF7RrY8E0M/aU998QyfG6xYKtQLp05/I=" crossorigin="anonymous"></script> | |
<script> | |
function SaveAsFile(t,f,m) { | |
try { | |
var b = new Blob([t],{type:m}); | |
saveAs(b, f); | |
} catch (e) { | |
window.open("data:"+m+"," + encodeURIComponent(t), '_blank',''); | |
} |
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 React from 'react'; | |
import {create as createXML} from 'xmlbuilder2'; | |
import { XMLBuilder, XMLBuilderCreateOptions, DefaultBuilderOptions, XMLWriterOptions } from "xmlbuilder2/lib/interfaces"; | |
function renderXMLElement(root: XMLBuilder, {type, props}: React.ReactElement) { | |
let node = root; | |
if (typeof type !== 'symbol') { | |
const elementName = typeof type == 'function' ? type.name: type; | |
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
function printR(htmlContent) { | |
let doc = nw.Window.get().window.document; | |
let iframe = doc.createElement("iframe"); | |
iframe.style.display = 'none'; | |
doc.body.appendChild(iframe); | |
iframe.onload = () => { | |
console.log('loaded'); | |
if (typeof htmlContent === 'function') { | |
htmlContent(iframe); |
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
@echo off | |
:: Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights | |
:: reserved. Use of this source code is governed by a BSD-style license | |
:: that can be found in the LICENSE file. | |
:: Set up the environment for use with MSVS tools and then execute whatever | |
:: was specified on the command-line. | |
set RC= |
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
/* | |
* This is a C++ translation/adaptation of | |
* A fast javascript implementation of simplex noise by Jonas Wagner | |
* Copyright 2018 Mauro Joel Schütz <[email protected]> | |
Based on a speed-improved simplex noise algorithm for 2D, 3D and 4D in Java. | |
Which is based on example code by Stefan Gustavson ([email protected]). | |
With Optimisations by Peter Eastman ([email protected]). | |
Better rank ordering method by Stefan Gustavson in 2012. |
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
// C version of | |
// Part 1: numbers and words — DRAFT 2 — 2008-09-06 | |
// http://scratch-lang.notimetoplay.org/scratch-lang.js | |
#include <ctype.h> | |
#include <string.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct _stack { |
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
#include <iterator> // std::iterator,std::input_iterator_tag | |
#include <iostream> // std::cout | |
template <typename T, size_t N> | |
class SampleVector | |
{ | |
T vector[N]; | |
public: | |
class iterator : public std::iterator<std::input_iterator_tag, T> | |
{ |
NewerOlder