Skip to content

Instantly share code, notes, and snippets.

View stanleyume's full-sized avatar
🎯
Focusing

Stanley Ume stanleyume

🎯
Focusing
  • Germany
  • 12:27 - 2h ahead
View GitHub Profile
@stanleyume
stanleyume / carryOperationsLong.js
Created July 16, 2022 18:17
Number of carry operations when adding two integers.
const numberOfCarryOperations = (a, b) => {
a = a.toString();
b = b.toString();
let diff = a.length - b.length;
let operations = 0;
if(diff > 0) {
for(let i=1; i<=diff; i++){
b = '0'+ b;
}
@stanleyume
stanleyume / google-drive.md
Last active December 1, 2020 16:55
Google Calendar API Credentials

How to obtain the credentials to communicate with Google Calendar

The first thing you’ll need to do is get credentials to use Google's API. I’m assuming that you’ve already created a Google account and are signed in. Head over to Google API console and click "Select a project" in the header.

1

Next up we must specify which APIs the project may consume. From the header, select "Enable APIs and Services".

@stanleyume
stanleyume / README.md
Last active December 1, 2020 14:54 — forked from mehranhadidi/!NOTE.md
Google Drive API Credentials

Google Drive API Credentials

Log in to your Google Account and go to this website:

https://console.developers.google.com/

Getting your Client ID and Client Secret

Create a new project using the dropdown at the top.

@stanleyume
stanleyume / !NOTE.md
Created April 9, 2020 16:57 — forked from ivanvermeyen/!NOTE.md
Setup a Laravel Storage driver with Google Drive API
@stanleyume
stanleyume / acceptRequests.js
Created August 17, 2019 15:34
JavaScript Code to Accept All Facebook Friend Requests
// Open the Facebook page that displays your friend requests. http://facebook.com/friends/requests/
// Press CTRL+SHIFT+i
// Select the "Console" tab
// Paste the code in the console, then hit ENTER.
document.querySelectorAll('button._42ft.selected[type=submit][aria-label^=Confirm]').forEach((btn)=> {btn.click()});
@stanleyume
stanleyume / editPage.js
Created June 4, 2019 20:52 — forked from pmarquees/editPage.js
Edit page (bookmarklet)
javascript:document.body.contentEditable = 'true'; document.designMode='on'; void 0
@stanleyume
stanleyume / php_object_to_array.php
Created February 13, 2019 08:38 — forked from victorbstan/php_object_to_array.php
recursively cast a PHP object to array
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);
@stanleyume
stanleyume / months-array.php
Last active July 23, 2018 01:27
PHP Months Array (Single & Associative)
<?php
$months_flat = array(
'January',
'February',
'March',
'April',
'May',
'June',
'July',