Skip to content

Instantly share code, notes, and snippets.

View datamafia's full-sized avatar
☠️
not here

" and 1=1 " datamafia

☠️
not here
  • At Desk
View GitHub Profile
@datamafia
datamafia / snippet.liquid
Created March 22, 2015 02:10
Shopify Snippets and similar items I don't feel like looking up again.
<!-- List tags for product -->
{% if product.tags.size > 0 %}
<div><span class="mellow" >tags:</span>
{% for tag in product.tags %}
<a href="/collections/all/{{ tag | replace: ' ','-' }}">{{ tag }}</a>
{% endfor %}
</div>
{% endif %}
@datamafia
datamafia / url_validation.py
Created March 24, 2015 01:03
Highly compliant Python URL validator
"""Check the validity of URL for maximum compliance, return "ready to
use" url address (with http:// as needed) on success
Abstract: Be dry. URL verification is a persistent need, this iteration
has been very handy for website use, such as profile creation and seems
to have a near total compliance with the changing URL schemas.
No code is prefect, olease let me know if you find error or have a proposed
patch.
@datamafia
datamafia / config.cfg
Last active August 29, 2015 14:17
MVP Proto for *.cfg reading (Python 2.7)
[section]
key=value
otherKey=otherValue
@datamafia
datamafia / ex.js
Last active November 18, 2015 21:54
Simple OOP reference for simple functionality across languages.
// class w/construct
var happy = function (msg) {
this.message = msg;
};
// method
happy.prototype.hello = function(){
console.log('hi');
console.log(this.message)
}
@datamafia
datamafia / buffer_multi_profile.py
Created April 3, 2015 18:18
Prototype for posting to multiple BufferApp profile ids
"""because the instructions were not clear to me, if I missed
something or this does not work drop a comment and I will fix.
After figuring this out I just wanted to put the solution
somewhere. Code pulled from working project."""
from __future__ import print_function
import os, urllib, url
buffer_base_url = 'https://api.bufferapp.com'
@datamafia
datamafia / timestamp.py
Created August 4, 2015 21:57
Shortest Possible Path to Unix Epoch Time in seconds
import calendar
from time import gmtime
print calendar.timegm(gmtime())
###################################
# Follow Me on Twitter @datamafia #
###################################
@datamafia
datamafia / sexy_or.py
Created October 23, 2015 15:05
Use of "or" in conjunction with update for setting variables
d = dict()
d['a'] = 1
d.update(
{
'a': 2
}
)
print d
@datamafia
datamafia / bobp-python.md
Created November 13, 2015 16:16 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@datamafia
datamafia / 0_reuse_code.js
Created January 3, 2016 03:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@datamafia
datamafia / aescrypt.py
Created January 6, 2016 03:11 — forked from SpotlightKid/aescrypt.py
Encrypt/decrypt files with symmetric AES cipher-block chaining (CBC) mode.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Encrypt/decrypt files with symmetric AES cipher-block chaining (CBC) mode.
Usage:
File Encryption:
aescrypt.py [-f] infile [outfile]