Skip to content

Instantly share code, notes, and snippets.

// count total spending https://store.steampowered.com/account/history/
var totall = 0;
var totalArr = [];
$('.wallet_history_table tbody tr').hide().filter(function(e){
var elem = $(this);
return elem.find('.wht_type').find('div').eq(0).text() === 'In-Game Purchase';
}).show().each(function(e){
var elem = $(this);
@arieffikhrie
arieffikhrie / post.php
Created November 1, 2016 04:52
Check POST method
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {}
@arieffikhrie
arieffikhrie / 404.php
Created November 1, 2016 04:54
Set header 404
<?php
header("HTTP/1.0 404 Not Found");
echo 'Page not found';
return;
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(searchElement, fromIndex) {
var k;
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
var len = o.length >>> 0;
if (len === 0) {
@arieffikhrie
arieffikhrie / animated-scrolling,js
Created November 3, 2016 08:38
Animated scrolling
$('a.page-scroll').click(function() {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 900);
return false;
}
@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)');
@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"}
// 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 / 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 =
Get-AutomationVariable -Name 'resourceGroupName'
Get-AutomationVariable -Name 'omsWorkspaceId'
Get-AutomationVariable -Name 'omsPrimarySharedKey'
Get-AutomationVariable -Name 'searchServiceName'
Get-AutomationVariable -Name 'searchAdminKey'