Skip to content

Instantly share code, notes, and snippets.

View josephnicholas's full-sized avatar
💻
Working from home

Joseph Nicholas R. Alcantara josephnicholas

💻
Working from home
View GitHub Profile
console->info("===== schduler =====");
console->info("main thread id: {}", getThreadId());
Rx::schedulers::run_loop runloop;
Rx::subject<int> subject;
auto observable = subject.get_observable();
observable
.map([&](int v) {
console->info("thread[{}] - published value: {}", getThreadId(), v);
return v;
@josephnicholas
josephnicholas / Instrumentor.h
Created June 4, 2021 04:06 — forked from TheCherno/Instrumentor.h
Basic Instrumentation Profiler
//
// Basic instrumentation profiler by Cherno
// Usage: include this header file somewhere in your code (eg. precompiled header), and then use like:
//
// Instrumentor::Get().BeginSession("Session Name"); // Begin session
// {
// InstrumentationTimer timer("Profiled Scope Name"); // Place code like this in scopes you'd like to include in profiling
// // Code
// }
@josephnicholas
josephnicholas / Splitter.sol
Created December 27, 2019 03:16 — forked from critesjosh/Splitter.sol
A contract to split funds between addresses. Demostrates pushing vs pulling transfers
pragma solidity ^0.4.6;
contract Splitter {
mapping(address => uint) public balances;
function unsafeSplit(address address1, address address2)
public
payable
returns(bool success)
@josephnicholas
josephnicholas / Adoption.sol
Created November 30, 2019 06:58
Pet Shop Tutorial with exercise on callers
pragma solidity ^0.5.0;
contract Adoption {
address[16] public adopters;
// Adopting a pet
function adopt(uint petId) public returns(uint) {
require(petId >= 0 && petId <= 15);
require(adopters[petId] != msg.sender, "Pet cannot be adopted by the same owners.");
require(adopters[petId] == address(0), "Pet has owner");

Keybase proof

I hereby claim:

  • I am josephnicholas on github.
  • I am josephnra (https://keybase.io/josephnra) on keybase.
  • I have a public key ASBTDtEk6k-L2sP16tCX52Kdbm35qmGr8GWwtRUW0WsZpgo

To claim this, I am signing this object:

@josephnicholas
josephnicholas / designer.html
Last active August 29, 2015 14:03
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../google-map/google-map-search.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">