Skip to content

Instantly share code, notes, and snippets.

View Artistan's full-sized avatar

Charles Peterson Artistan

View GitHub Profile
// use this transport for "blob" data type
// http://artandlogic.com/2013/11/jquery-ajax-blobs-and-array-buffers/
(function($){
/**
* Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2
* within the comfortable framework of the jquery ajax request, with full support for promises.
*
* Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list
* of potential transports (so it gets first dibs if the request passes the conditions within to provide the
@Artistan
Artistan / recursive.find.js
Last active April 3, 2016 23:54
Find properties within a javascript object/array
function recursiveIterationKey(object,matchKey) {
var found=false;
for (var property in object) {
if (object.hasOwnProperty(property)) {
if (typeof object[property] == "object"){
if(recursiveIterationKey(object[property])){
found=true;
break;
} else if(matchKey==property) {
found = true;
@Artistan
Artistan / object_join.js
Created May 4, 2016 04:18 — forked from lucasdavila/object_join.js
Joining javascript key-value objects as string.
Object.prototype.join = function(glue, separator) {
var object = this;
if (glue == undefined)
glue = '=';
if (separator == undefined)
separator = ',';
return $.map(Object.getOwnPropertyNames(object), function(k) { return [k, object[k]].join(glue) }).join(separator);
@Artistan
Artistan / css-styles.js
Last active May 4, 2016 04:57
Ember CSS-STYLES helper
import Ember from 'ember';
/*
Template:
<div style={{css-styles background-url='url("this/is/my/url")' color="red"}}>My Fill Color</div>
OR
<li id="{{index}}" style={{css-styles background-url=(concat 'url("' photo.thumbnail '")') }}></li>
*/
export function cssStyles(params, hash) {
@Artistan
Artistan / decode.js
Last active June 3, 2016 02:38
decipher qrcode
qrcode.callback = function(data){
jQuery('#qrdata').html(data);
}
var loadFile = function(event) {
var url = URL.createObjectURL(event.target.files[0]);
qrcode.decode(url);
};
@Artistan
Artistan / .htaccess
Created September 8, 2016 17:13 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@Artistan
Artistan / DB_Sessions.php
Created December 5, 2016 18:54
sessions database manager - php
<?php
/**
* Initial Setup of file
* Garbage collection sucks, we should have a time check during read and auto destroy/not recover old sessions
*/
class DB_Sessions
{
var $session_life = 300;
var $sessiontable = 'sessions';
@Artistan
Artistan / 00-not getting private_network IP
Last active December 19, 2016 01:16
not getting the private_network ip.
using nfs fails, default works.
macOS Sierra 10.12.1
VirtualBox 5.1.10
Vagrant 1.9.1
Virtualbox Guest Additions 5.1.10
plugins...
vagrant-bindfs 1.0.2
vagrant-vbguest 0.13.0
@Artistan
Artistan / 00-not getting private_network IP
Created December 19, 2016 02:33
not getting private_network IP another attempt
disabled everything from install and IP still not working.
@Artistan
Artistan / config.yaml
Last active December 19, 2016 03:47
test centos 6.5
vagrantfile:
target: local
vm:
provider:
local:
box: puphpet/centos65-x64
box_url: puphpet/centos65-x64
box_version: '0'
chosen_virtualizer: virtualbox
virtualizers: