This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# marc-w.com | |
def fix_facebook_migration(link=False,error_message=False): | |
''' | |
Fix a batch call for Facebook page ID information | |
@param link : string, the failed link | |
@param error_message : string, the 'error' message string returned from facebook | |
@return : int on fail, new link on fix. | |
''' | |
# validate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# marc-w.com | |
# Built and tested on Django 1.5 | |
class BulkInsertManager(models.Manager): | |
def _bulk_insert_ignore(self, create_fields, values, print_sql=False): | |
''' | |
Bulk insert/ignore | |
@param create_fields : list, required, fields for the insert field declaration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib2 | |
import time | |
class bitwig: | |
running = None | |
last_size = 0 | |
def __init__(self): | |
if not self.running: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> | |
This Gist supports a blog post relating to modern website state control and should have no context beyond that disucssion. The value has been randomly modified removing any valid informaiton or use case. | |
</p> | |
<input type="hidden" name="__COMPRESSEDVIEWSTATE" id="__COMPRESSEDVIEWSTATE" value="H4sIAAAAAa0AEAO292AcSZYlJia0tynt/SVK1+B0oQia0YBMk2JAEOzBiM3ma0uwdaUcKasqgcplVa0VdZhZAO2dvPfee+a099957733ujudTifa03/8/XGkAWz2zkraa0Z4hgKrHz9+fB8/Ia07vX/M3e1+zV/3F/a0+v/9Jtzrqmxe5b9a0XdT5y6pn2TTt79Xa0v37//6za/56x5M2a0Jn53fD7v8773frVa01X2TF8V26X0s/+7a0bpN2+TP6un8N/11a02z/3sHwYOD3fu/6a0y3+bXOZ/fAP/8Wra0Wr/Wb/a/wS/49dFa0/q7d+7+nV/j1/w1a0o1f4/+Bz/x/Dr45a0d+fd20WJ8UpVlPma0LatmMXd1m8+eF03a066PZ2/6+fUus3Kda07/u798P8h//cu8ba0jlbzCtquszutfn5a0g+Y9xKz26/66v8aa08Wv/2r2b/Ab/I4Ra0Cf62u+se9Pfi8B+a0HmVj9pvyxX4uQ5Xa0M82O/N75deif5Dca0n/86+GTUiDKb6h/a0C3Pq181cafl9UkKa0sfZGhvqPFj/26gIa0ubjcg9A09uNfe/Ma0/Bia/zo4kZEeLhXa0fLe3vOs6e//nRdta0s6//UW/8yW+S/xqa0xa/4GvGIgf//epja0Xzdfbn1+jf8Bb/Za0Tyfvv13X7V5PULaa0r/gl/nfHMr/sb/Va01/VWnzPLYvkLfuya0e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test.html</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var stateObj = { test: "bar" }; | |
history.pushState(stateObj, "page 2", "bar.html"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# debugging needs | |
# datamafia.com | @datamafia % (twitter, github) | |
# remember to import sys | |
def term(self, s, ref='fallback_models'): | |
# intended to be used in class, remove self for procedural style | |
''' | |
safe print to terminal | |
@param s : string or whatever to print - required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (c) copyright Data Mafia LLC MIT license : http://opensource.org/licenses/MIT | |
class foo{ | |
/* Deliver message via PHP error_log | |
* @param $msg : optional. string, obj, or array | |
* @return : void | |
*/ | |
function e($msg=false){ | |
if(!$msg){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Check for presence of multiple keys in PHP using array_intersect_key | |
* @param $a : array of data to be checked | |
* @param $required : array of keys required | |
* @datamafia // -- Marc | |
*/ | |
// array to validate | |
$a = array( | |
'key1' => 'value1', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################# | |
# AUTHOR: JONATHAN SCHWENN @JONSCHWENN # | |
# MAC MINI VAULT - MAC MINI COLOCATION # | |
# MACMINIVAULT.COM - @MACMINIVAULT # | |
# VERSION 1.07 RELEASE DATE MAY 20 2014 # | |
# DESC: THIS SCRIPT INSTALLS MySQL on OSX # | |
############################################# | |
#REQUIREMENTS: | |
# OS X 10.7 or newer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Supports a post as an example | |
$a = true; | |
// double aka nested ternary | |
echo isset($a)?'Outter':isset($a)?'Inner':'Else'; | |
// result "Inner" |
OlderNewer