Skip to content

Instantly share code, notes, and snippets.

@kares
kares / jquery.parseparams.js
Created May 5, 2011 11:28
jQuery.parseParams - parse query string paramaters into an object
/**
* $.parseParams - parse query string paramaters into an object.
*/
(function($) {
var re = /([^&=]+)=?([^&]*)/g;
var decodeRE = /\+/g; // Regex for replacing addition symbol with a space
var decode = function (str) {return decodeURIComponent( str.replace(decodeRE, " ") );};
$.parseParams = function(query) {
var params = {}, e;
while ( e = re.exec(query) ) {
@hungsu
hungsu / scrollTop.js
Last active March 26, 2020 14:14
Scroll to top of page, cross browser
document.body.scrollTop = document.documentElement.scrollTop = 0;
/*
* Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, version 2.1.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
@kmturley
kmturley / data-functions.js
Created May 12, 2015 20:46
Re-written date functions to not use eval()
/*
* Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, version 2.1.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
@chinchang
chinchang / xmlToJson.js
Last active September 7, 2023 02:39
Function to convert XML to JSON
/**
* Changes XML to JSON
* Modified version from here: http://davidwalsh.name/convert-xml-json
* @param {string} xml XML DOM tree
*/
function xmlToJson(xml) {
// Create the return object
var obj = {};
if (xml.nodeType == 1) {
@franciscocpg
franciscocpg / jetty-install-debian.sh
Last active May 21, 2020 14:51
Install jetty on debian
#!/bin/bash
# do in tmp
cd /tmp
JETTY_FILE='jetty-distribution-9.3.3.v20150827.tar.gz'
JETTY_FOLDER=${JETTY_FILE:0:-7}
# Download
wget http://download.eclipse.org/jetty/stable-9/dist/$JETTY_FILE
# Extract
sudo tar zxvf $JETTY_FILE -C /opt/
@abnersajr
abnersajr / traceRouteMap.js
Last active October 16, 2022 00:09
Trace Route using Maps API Javascript V3
function traceRouteMap() {
var mapElement = document.getElementById('google-map');
var directionsService = new google.maps.DirectionsService();
var startLatLng = new google.maps.LatLng(-29.687306,-53.815477);
var directionsDisplay= new google.maps.DirectionsRenderer();
var geocoder = new google.maps.Geocoder();
var markers = [];
var center;
var mapOptions = {
zoom: 12,
@codediodeio
codediodeio / database.rules.json
Last active May 11, 2025 08:08
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@kossnocorp
kossnocorp / v2-pre-releases.md
Last active October 19, 2020 11:33
date-fns v2 pre-releases change log
@echo off
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
@rem *** Disable Some Service ***
sc stop DiagTrack
sc stop diagnosticshub.standardcollector.service
sc stop dmwappushservice
sc stop WMPNetworkSvc
sc stop WSearch