Skip to content

Instantly share code, notes, and snippets.

@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;
}
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 / 404.php
Created November 1, 2016 04:54
Set header 404
<?php
header("HTTP/1.0 404 Not Found");
echo 'Page not found';
return;
@arieffikhrie
arieffikhrie / post.php
Created November 1, 2016 04:52
Check POST method
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {}
// 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);