Skip to content

Instantly share code, notes, and snippets.

@arieffikhrie
arieffikhrie / google.js
Created October 26, 2022 10:17
Test puppeteer on google.com
const puppeteer = require("puppeteer-core"); // v13.0.0 or later
const path = require("path");
(async () => {
const browser = await puppeteer.launch({
executablePath:
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
});
const page = await browser.newPage();
const timeout = 5000;
@arieffikhrie
arieffikhrie / Code.gs
Created October 11, 2020 16:05 — forked from rheajt/Code.gs
examples of simple triggers with google apps script
/**
* These simple triggers are available in Sheets, Docs, and Forms
* Most of this information can be found:
* https://developers.google.com/apps-script/guides/triggers/events
*/
function onOpen(e) {
// {
// authMode: 'LIMITED',
// source: 'Spreadsheet' || 'Document' || 'Form',
// user: 'User'
@arieffikhrie
arieffikhrie / file-sorter.ps1
Created August 10, 2020 13:31
Sorting animes
$path = (Get-Location).Path
$FileExtension = ".mkv";
$list = Get-ChildItem -Path $path -File | Where-Object {$_.extension -eq $FileExtension}
foreach ($file in $list) {
$filename = $file.name -replace "\[.*?\]", ""
$filename = ($filename -replace $FileExtension, "").Trim()
$filename2 = $filename -Split "-"
$filename3 = $filename2[0..($filename2.length - 2)]
@arieffikhrie
arieffikhrie / compare-hash.ps1
Last active August 6, 2020 17:05
Comparing files between 2 folders
$path1 = "./dist";
$path2 = "./dist2";
$files = Get-ChildItem $path1 -recurse
$mainPath = Get-Location;
foreach ($file in $files)
{
if ($file.PSIsContainer -eq $false) {
Set-Location $path1
@arieffikhrie
arieffikhrie / Test.php
Last active April 11, 2019 07:34
dynamic method name for class
<?php
class Test {
private $data = [
'first' => 1,
'second' => 2,
'third' => 3,
'hundredTH' => 100,
'5Fifth' => 5 // following method rules, method never start with a digit, so this will return false
];
Get-AutomationVariable -Name 'resourceGroupName'
Get-AutomationVariable -Name 'omsWorkspaceId'
Get-AutomationVariable -Name 'omsPrimarySharedKey'
Get-AutomationVariable -Name 'searchServiceName'
Get-AutomationVariable -Name 'searchAdminKey'
@arieffikhrie
arieffikhrie / test.cs
Created December 14, 2018 08:09
Azure oauth access token c#
string azureLoginOauthUri = "https://login.microsoftonline.com/" + _tenantID + "/oauth2/token";
string azureLoginResource = HttpUtility.UrlEncode(AuthenticationContextResource);
string azurePostBody = "grant_type=client_credentials&client_id=" + _applicationID + "&client_secret=" + _applicationSecret + "&resource=" + azureLoginResource;
HttpRequestMessage httpRequestMessage = new HttpRequestMessage()
{
RequestUri = new Uri(azureLoginOauthUri),
Method = HttpMethod.Post,
Content = new StringContent(azurePostBody, Encoding.UTF8, "application/x-www-form-urlencoded"),
Headers =
// This script only can be used at http://timepaz.com/EyeTest/ , just open console and copied this code
var _$ = jQuery;
var $div = _$('#box');
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.attributeName === "class") {
const attributeValue = $(mutation.target).prop(mutation.attributeName);
const mapElem = {};
const currentClass = '';
@arieffikhrie
arieffikhrie / cloudSettings
Last active September 11, 2018 12:19
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-09-11T12:19:48.482Z","extensionVersion":"v3.1.2"}
@arieffikhrie
arieffikhrie / fare-calc.js
Last active October 17, 2023 18:48
uber fare calculator
(function($){
var currentCur = 'MYR';
var tripsTable = $('#trips-table');
var fareColHeader = tripsTable.find('thead tr th:nth-child(4)');
var fareColHeaderSum = fareColHeader.find('.af-faresum');
if ( fareColHeaderSum.length === 0 ){
fareColHeaderSum = $('<span class="af-faresum">(<span class="af-faresumval">' + currentCur +'0.00</span>)</span>');
}
fareColHeader.append(fareColHeaderSum);
var fareCol = tripsTable.find('tbody tr td:nth-child(4)');