Skip to content

Instantly share code, notes, and snippets.

View wehmoen's full-sized avatar
:fishsticks:
Always working

wehmoen wehmoen

:fishsticks:
Always working
View GitHub Profile
window.location.getParam = function(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
result = regex.exec(window.location.search);
if (result == null) {
return false;
}
@wehmoen
wehmoen / getBrowser
Created November 21, 2014 23:36
JavaScript Utils
function getBrowser(userAgent) {
var version,webkitVersion,iOSAgent,iOSDevice,iOSMajorVersion,iOSMinorVersion,browser={};
userAgent=(userAgent||navigator.userAgent).toLowerCase();language=navigator.language||navigator.language||navigator.browserLanguage;
version=browser.version=(userAgent.match(/.*(?:rv|chrome|webkit|opera|ie)[\/: ](.+?)([ \);]|$)/)||[])[1];
webkitVersion=(userAgent.match(/webkit\/(.+?) /)||[])[1];iOSAgent=(userAgent.match(/\b(iPad|iPhone|iPod)\b.*\bOS (\d)_(\d)/i)||[]);
iOSDevice=iOSAgent[1];iOSMajorVersion=iOSAgent[2];iOSMinorVersion=iOSAgent[3];browser.windows=browser.isWindows=!!/windows/.test(userAgent);
browser.mac=browser.isMac=!!/macintosh/.test(userAgent)||(/mac os x/.test(userAgent)&&!/like mac os x/.test(userAgent));
browser.lion=browser.isLion=!!(/mac os x 10[_\.][7-9]/.test(userAgent)&&!/like mac os x 10[_\.][7-9]/.test(userAgent));
browser.iPhone=browser.isiPhone=(iOSDevice==="iphone");browser.iPod=browser.isiPod=(iOSDevice==="ipod");
browser.iPad=browser.isiPad=(iOSDevice==="i
@wehmoen
wehmoen / pkmn.js
Created August 10, 2016 13:20
The whole Pokédex as JS Object
pkmn = {"460":"Abomasnow","63":"Abra","359":"Absol","617":"Accelgor","681":"Aegislash","142":"Aerodactyl","306":"Aggron","190":"Aipom","65":"Alakazam","594":"Alomomola","334":"Altaria","698":"Amaura","424":"Ambipom","591":"Amoonguss","181":"Ampharos","347":"Anorith","24":"Arbok","59":"Arcanine","493":"Arceus","566":"Archen","567":"Archeops","168":"Ariados","348":"Armaldo","683":"Aromatisse","304":"Aron","144":"Articuno","531":"Audino","699":"Aurorus","713":"Avalugg","610":"Axew","482":"Azelf","184":"Azumarill","298":"Azurill","371":"Bagon","343":"Baltoy","354":"Banette","689":"Barbaracle","339":"Barboach","550":"Basculin","411":"Bastiodon","153":"Bayleef","614":"Beartic","267":"Beautifly","15":"Beedrill","606":"Beheeyem","374":"Beldum","182":"Bellossom","69":"Bellsprout","712":"Bergmite","400":"Bibarel","399":"Bidoof","688":"Binacle","625":"Bisharp","9":"Blastoise","257":"Blaziken","242":"Blissey","522":"Blitzle","525":"Boldore","438":"Bonsly","626":"Bouffalant","654":"Braixen","628":"Braviary","286":"Breloom
@wehmoen
wehmoen / status.html
Created April 5, 2017 08:03
Minecraft Server Status with jQuery
<script>
$(function () {
var host = "griefergames.net";
var port = 25565;
$('.serverHost').text(host + ':' + port);
window.checkServerStatus = setInterval(function () {
$.ajax({
url: 'https://mc.x64.rocks/status/?host=' + host + '&port=' + port,
success: function(data) {
@wehmoen
wehmoen / codes.txt
Created July 29, 2018 16:04
DTube Voucher DEMO codes
2S9Z8C-CJR9
2U9QZJ-N9CY
FSHDZM-WEPJ
G3WLQR-SSRJ
XF93YY-MZD9
4JZ8FL-NWEW
HNMA25-JS62
FRZNAZ-MG3B
BDUVVY-HLGG
MPTQSC-AH9E
@wehmoen
wehmoen / rc.js
Created January 31, 2019 02:45
Get RC account
const getAccountRC = async (account) => {
try{
const rawResponse = await fetch('https://api.steemit.com/', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({"jsonrpc":"2.0", "method":"rc_api.find_rc_accounts", "params":{"accounts":[account]}, "id":1})
});
@wehmoen
wehmoen / claim.js
Created July 14, 2019 20:09
Claim all pending SCOT rewards
const fetch = require("node-fetch");
const steem = require("steem");
const account = "scot";
const wif = "5KYeFYCTtFAqoor4dBt4CDbLXnPyKbP2gmoPWpHtgspJ47MbWQh";
async function getTokensToClaim() {
let claimAble = [];
let token = await (await fetch('https://scot-api.steem-engine.com/@' + account, {method: 'GET'})).json();
@wehmoen
wehmoen / claim_browser.js
Last active July 31, 2019 01:42
claim_browser.js
const account = SE.User.name;
async function getTokensToClaim() {
let claimAble = [];
let token = await (await fetch('https://scot-api.steem-engine.com/@' + account, {method: 'GET'})).json();
for (let i in token) {
if (token[i].pending_token > 0) {
claimAble.push({
@wehmoen
wehmoen / community.js
Created November 23, 2019 18:18
Steem Communiy Creation
const sprintf = require("util").format;
const assert = require("assert");
const steem = require("steem");
const creatorActiveKey = "your_active_key";
const creatorPostingKey = "your_posting_key";
const creatorPublicMemoKey = "your_public_memo_key";
const creator = "your_account";
async function setProps(community, admin, title, description) {
@wehmoen
wehmoen / load.js
Created December 27, 2019 14:59
load bgb
This file has been truncated, but you can view the full file.
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (Buffer){
const steem = require("steem");
async function getBinary(block, tx, hoster) {
return new Promise((resolve, reject) => {
steem.api.getBlock(block, (e, r) => {
if (!r.transaction_ids.includes(tx)) {
resolve([])
} else {