Skip to content

Instantly share code, notes, and snippets.

View imolorhe's full-sized avatar
🕴️
Release!

Samuel imolorhe

🕴️
Release!
View GitHub Profile
@imolorhe
imolorhe / README.md
Last active November 9, 2020 06:06
My OneDark Pro inspired theme configuration for Altair.
1 << 2
4 << 1 // bitwise left shift operator
// d - 4
// b - 100
// >> n
// << n => 2 ^ n
/**
* @param {string} n
* @return {string}
*/
var nearestPalindromic = function(n) {
const nN = BigInt(n);
if (n == 11n) {
return "9";
}
const palindrome = getUniquePalindrome(n);
@imolorhe
imolorhe / electron-store-adapter.js
Last active October 11, 2019 06:47
Electron helpers
const ElectronStore = require('electron-store');
class ElectronStoreAdapter {
constructor() {
this.store = new ElectronStore();
}
/**
* Returns the number of key/value pairs currently present in the list associated with the object.
*/
@imolorhe
imolorhe / rpc.md
Created September 10, 2019 18:14 — forked from creationix/rpc.md
Simple RPC design

I've designed a lot of RPC protocols in my career. One pattern that's worked well basically goes as follows:

// Client calls: print('Hello World\n')
-> [1, "print", "Hello World!\n"]
// Server sends return value (or lack of return vvalue)
<- [-1]

// Client calls: add(1, 2)
-> [2, "add", 1, 2]

https://github.com/Siubaak/sval

import Sval from 'sval'

// Sval options
const options = {
  // ECMA Version of the code (5 | 6 | 7 | 8 | 9 | 10 | 2015 | 2016 | 2017 | 2018 | 2019)
  ecmaVer: 9,
 // Whether the code runs in a sandbox
import Amplify, { API, graphqlOperation } from "aws-amplify";
// import API from '@aws-amplify/api';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig) // *not sure
API.configure(awsconfig);
// Subscribe to creation of Todo
const SubscribeToEventComments = `subscription subscribeToComments {
subscribeToComments {
it('should write the clipping text to the clipboard', async () => {
await app.client.waitUntilWindowLoaded();
await app.electron.clipboard.writeText('Vegan Ham');
await app.client.click('#copy-from-clipboard');
await app.electron.clipboard.writeText('Something different');
await app.client.click('.copy-clipping');
const clipboardText = await app.electron.clipboard.readText();
return assert.equal(clipboardText, 'Vegan Ham');
});
// Copyright 2012, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above