Skip to content

Instantly share code, notes, and snippets.

View philoniare's full-sized avatar
🎯
Deep Work

philoniare philoniare

🎯
Deep Work
  • United States
View GitHub Profile
/// Basics
async fn main() {
// What is the difference between these two?
let s1 = "Hello World";
let s2 = String::from("Hello World");
// What is the difference between these two?
// Which is preferred in which cases?
fn foo(s: &str) {}
@philoniare
philoniare / readme.md
Last active March 7, 2024 13:16
Proof of Candidate Work on polkadot-sdk

Hi, I'm a recent PBA graduate and have just started contributing to polkadot-sdk. I would be incredibly grateful for the opportunity to join the fellowship program as a humble learner at the rank of I Dan. I've been fortunate to receive excellent mentorship and guidance from @ggwep and @gupnik, which has helped me begin making meaningful contributions.

While I still have a lot to learn, I'm deeply committed to growing my skills and becoming a valuable member of the Polkadot community for the long haul. I'm excited to dive in, absorb knowledge from the talented developers here, and steadily ramp up my contributions in the months and years ahead.

So far, I've made a few initial PRs to polkadot-sdk:

@philoniare
philoniare / gist:37b59e3f40b3f525e514435e5eb22875
Last active January 20, 2024 08:35
assignment_3_tests.rs
#[cfg(test)]
mod tests {
use super::*;
use crate::shared::{AccountId, Balance, RuntimeCallExt, EXISTENTIAL_DEPOSIT};
use parity_scale_codec::Encode;
use shared::{Extrinsic, RuntimeCall, VALUE_KEY};
use sp_core::hexdisplay::HexDisplay;
use sp_io::TestExternalities;
use sp_keyring::AccountKeyring;
use sp_runtime::{
use super::*;
// Helper Methods
fn empty_wallet() -> Wallet {
Wallet::new(vec![].into_iter())
}
fn wallet_with_alice() -> Wallet {
Wallet::new(vec![Address::Alice].into_iter())
}
// Decorator to cache function results
function Cache(duration: number) {
const cache = new Map<string, { expiry: number, value: any }>();
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
const originalMethod = descriptor.value;
descriptor.value = async function (...args: any[]) {
const key = JSON.stringify(args);
const cached = cache.get(key);
if (cached && cached.expiry > Date.now()) {
return cached.value;
import matplotlib.pyplot as plt
import numpy as np
from torch import nn, optim
from torch.autograd import Variable
def test_network(net, trainloader):
criterion = nn.MSELoss()
optimizer = optim.Adam(net.parameters(), lr=0.001)
###########################################
# Suppress matplotlib user warnings
# Necessary for newer version of matplotlib
import warnings
warnings.filterwarnings("ignore", category = UserWarning, module = "matplotlib")
###########################################
import matplotlib.pyplot as pl
import numpy as np
import sklearn.learning_curve as curves
@philoniare
philoniare / gist:88f09df8c796091240ed35dc39dba301
Last active August 1, 2017 04:30
ViewHolder + ButterKnife
package com.ohhstudio.mitc.inventory;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;