Skip to content

Instantly share code, notes, and snippets.

View alloyking's full-sized avatar
🎧
.

Tim Shultis alloyking

🎧
.
View GitHub Profile
@alloyking
alloyking / result_params.js
Last active August 29, 2015 13:56
js urlParams
param = {
params: [],
set: function(key, value){
if(!this.update(key, value)){
this.add(key, value);
}
},
add: function(key, value) {
param_obj = {};
param_obj[key] = value;
@alloyking
alloyking / nwmnode.sh
Created February 26, 2014 14:22
centos startup nodejs
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
# Creamos un fichero PID para monit
SCRIPT="$(basename $0)"
@alloyking
alloyking / python-mysql-backup
Created April 29, 2014 17:42
Python mysql backup
#!/usr/bin/env python
import os
import time
username = 'backup'
password = 'password'
hostname = 'localhost'
filestamp = time.strftime('%Y%m%d')
database_list_command = "mysql -u%s -p%s -h%s --silent -N -e 'show databases'" % (username, password, hostname)
for database in os.popen(database_list_command).readlines():
database = database.strip()
@alloyking
alloyking / array duplicates
Created April 30, 2014 02:32
js array duplicates
Array.prototype.unique = function () {
var r = new Array();
o:for(var i = 0, n = this.length; i < n; i++)
{
for(var x = 0, y = r.length; x < y; x++)
{
if(r[x]==this[i])
{
alert('this is a DUPE!');
continue o;
<?php
/*
Plugin Name: Remote Login
Description: Log into the site with creds that work on remote site (as defined in plugin). The remote site must have XML-RPC enabled.
Author: Kailey Lampert
Author URI: http://kaileylampert.com/
THIS IS NOT COMPLETE - DO NOT USE IN PRODUCTION
The remote site (defined below in $server) is the "master" site.
@alloyking
alloyking / data.json
Last active August 29, 2015 14:01
example
{
"timestamp": "ISODate('2015-10-10T23:06:37.000Z')",
"post": {
"blog": "2",
"type": "post",
"id": "148355",
"title": "20 ways to have a relationship",
"permalink": "http:\/\/ktis.pdpw-kltr.accessdomain.com\/2014\/02\/twenty-20-ways-to-have-a-relationship\/",
"tax": [{
"taxonomy": "category",
/* Check if users can register. */
$registration = get_option( 'users_can_register' );
/* If user registered, input info. */
$userdata = array(
'user_pass' => esc_attr( $args[2] ),
'user_login' => esc_attr( $args[0] ),
'first_name' => esc_attr( "" ),
<?php
/*
Plugin Name: Authenticate Users Remotely
Author: Christopher Davis
Author URI: http://www.christopherguitar.net/
License: GPL2
*/
add_filter('xmlrpc_methods', 'wpse39662_add_login_method' );
/**
@alloyking
alloyking / index.html
Last active August 29, 2015 14:04
square / rectangle entry position
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<div id="square" style="background-color: #ccc; width:200px; height:140px;">
@alloyking
alloyking / sw.js
Created February 11, 2015 13:48
service worker test
//