Skip to content

Instantly share code, notes, and snippets.

View decal's full-sized avatar
🏠
Working from home

Derek Callaway decal

🏠
Working from home
View GitHub Profile
@joekur
joekur / html_safe.md
Last active December 11, 2023 22:57
Proper Use of `html_safe`

Proper use of html_safe

Let's look at an innocuous piece of ruby. Consider some view code showing a user's name and phone number:

"#{first_name} #{last_name} #{phone}"

Great - this is very succinct, readable, and can easily be extracted to a method in a

@VEnis
VEnis / python_function_arguments
Last active March 11, 2018 14:43
Aggregating function arguments from inside function call
#http://kbyanc.blogspot.com/2007/07/python-aggregating-function-arguments.html
def arguments():
"""Returns tuple containing dictionary of calling function's
named arguments and a list of calling function's unnamed
positional arguments.
"""
from inspect import getargvalues, stack
posname, kwname, args = getargvalues(stack()[1][0])[-3:]
posargs = args.pop(posname, [])
@fenneh
fenneh / IIS75.ps1
Created May 24, 2012 14:02
Install & Patch IIS7.5 Basic
# Script to configure web application servers
### Supporting functions ###############################################################
function Install-Features($RolesToInstall) {
$args = @("/Online")
$args += "/Enable-Feature"
foreach ($role in $RolesToInstall) {
$args += "/FeatureName:$role"
}
& $env:windir\system32\dism $args