Skip to content

Instantly share code, notes, and snippets.

View ripdaria.py
#!/usr/bin/env python3
import csv
import sys
import subprocess
from collections import namedtuple
DiskTrack = namedtuple("DiskTrack", "disk track episode name filename")
@brandonhesse
brandonhesse / scrub.py
Created Mar 19, 2016
Modified a script I found in /r/learnpython
View scrub.py
"""
Un-scrape
Downloads images from the ~NEW~ section on Unslash.com and stores them for later use
Created by Roulx
Modified by midelh
"""
# I'm in python3 on this PC,
# so this should allow me to use my print and you can still run this in py2
from __future__ import print_function
import json #json over csv, personal preference
View directive.js
ng.directive('smGroup', ['$cacheFactory', '$log', function ($cacheFactory, $log) {
var cache = $cacheFactory('smGroupModelCache');
function searchAndDestroy(array, target) {
var index, found;
if (!Array.isArray(array)) {
return false;
}
View checkbox.js
(function () {
'use strict';
var checkbox = (function checkBoxBuilder() {
var prototype = {
values: function () {
var keys = Object.keys(this);
var type = this;
return keys.filter(function (key) {
return type[key];
});
View checkboxes.js
(function(ng, undefined) {
ng.module('sm.directive')
.factory('es6Macro', [function es6Macro() {
// ECMAScript6 style string replacement implemented in ES5
return function macro(replace, macroString) {
var compiled = macroString,
keyR = Object.keys(replace),
replacementR = keyR.map(function (key) {
return new RegExp('\\${' + key + '}', 'g');
}), keyIdx, replacementCnt = replacementR.length;
View streamer3.py
#!/usr/bin/python
from __future__ import print_function
from argparse import ArgumentParser, Namespace
import subprocess
import logging
import sys
import os.path
try:
import configparser as cp
View product_dept.txt
social/sys/classes/mvses.reports.class.php:139: LEFT JOIN product_dept pd ON t.ptype = pd.id
social/sys/classes/mvses.credits.class.php:238: LEFT JOIN product_dept pd ON p.department_id = pd.id
social/sys/func/cron.sync.system_updates.php:87: $dept = $mydb->GetOne("SELECT department FROM product_dept WHERE id={$deptid}");
social/sys/era404.mvses.setup.php:155:echo "<b>====|| CREATING product_dept TABLE:<br /></b><ul>";
social/sys/era404.mvses.setup.php:156: $query = "CREATE TABLE IF NOT EXISTS product_dept (
social/sys/era404.mvses.setup.php:180:echo "<b>====|| POPULATING product_dept TABLE:<br /></b><ul>";
social/sys/era404.mvses.setup.php:182: $query = "INSERT IGNORE INTO product_dept (id, department, item) VALUES ($did, '{$d[0]}','{$d[1]}')";
@brandonhesse
brandonhesse / matches.js
Last active Aug 29, 2015
Matches in both items
View matches.js
.filter('findMatches', [function() {
return function findMatches(arr1, arr2) {
// We cache because JS has some funny properties.
var len1, len2, i, j, matches, match;
// Because you're passing in strings
arr1 = arr1.split(' ');
arr2 = arr2.split(' ');
// Since the container will always be filled with matches
matches = [];
@brandonhesse
brandonhesse / SerializerDecoratorSample.php
Created Apr 16, 2015
Sample of what modular serializer might look like
View SerializerDecoratorSample.php
<?php
interface DecoratorInterface {
public function dectorate($value, array $options);
public function supports($class);
}
class InvalidDecoratorSerilizationException extends \Exception {};
class DateTimeDecorator impliments DecoratorInterface {
You can’t perform that action at this time.