Skip to content

Instantly share code, notes, and snippets.

View funkatron82's full-sized avatar

Manny Fleurmond funkatron82

View GitHub Profile
@TheMatt2
TheMatt2 / walklevel.py
Last active April 13, 2023 22:12
A python function to do an os.walk(), but only to a certain depth. A negative depth indicates full depth.
# MIT License
#
# Copyright (c) 2021 Matthew Schweiss
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@thomsbg
thomsbg / delegate_events.js
Created September 11, 2013 18:38
Redefining delegateEvents() on a collection view to handle children's events too
App.Views.CommentList = Backbone.View.extend({
childrenById: {},
childSelector: 'div',
childView: function() {
return App.Views.Comment;
},
// Bind child event handlers once, instead of once per child view
delegateEvents: function() {
// Call super
@kourge
kourge / context_manager.php
Last active August 9, 2023 03:25
A simple user-space PHP `with` implementation that mimics Python context managers.
<?php
class Context {
private $args = array();
private $func = NULL;
public function __construct() {
$args = func_get_args();
$func = array_pop($args);
@trepmal
trepmal / wp.media.query.php
Last active August 12, 2019 14:08
wp.media.query() works in the console, but not when run like this in a plugin. halp?
<?php
/*
* Plugin Name: wp.media.query
* Plugin URI: trepmal.com
* Description:
* Version: 0
* Author: Kailey Lampert
* Author URI: kaileylampert.com
* License: GPLv2 or later
* TextDomain:
.select2-container .select2-choice {
border: 2px solid #dce4ec;
font-family: "Lato", sans-serif;
font-size: 14px;
text-indent: 1px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: none;
-moz-box-shadow: none;