This file contains hidden or 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
[29] pry(main)> foo = 'a&b*c d' | |
=> "a&b*c d" | |
[30] pry(main)> URI::escape(foo, /[^a-zA-Z0-9\-\.\_\~]/) | |
=> "a%26b%2Ac%20d" | |
[31] pry(main)> uri_val = URI.escape(foo, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) | |
=> "a%26b*c%20d" | |
[32] pry(main)> CGI.escape(foo) | |
=> "a%26b%2Ac+d" | |
[33] pry(main)> URI.escape(foo) | |
=> "a&b*c%20d" |
This file contains hidden or 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
module OAuth | |
def self.build_signature oauth | |
request_params = oauth[:request_params] | |
request_params[:oauth_consumer_key] = oauth[:oauth_consumer_key] | |
request_params[:oauth_nonce] = oauth[:oauth_nonce] | |
request_params[:oauth_signature_method] = 'HMAC-SHA1' | |
request_params[:oauth_timestamp] = oauth[:oauth_timestamp] | |
request_params[:oauth_token] = oauth[:oauth_token] | |
request_params[:oauth_version] = '1.0' |
This file contains hidden or 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 bash | |
# | |
# execute this script with: | |
# wget -qO- https://gist.github.com/alanstevens/5296018/raw/vagrant_setup.sh|bash | |
# | |
echo "You will be prompted for your password by sudo." | |
# |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Web.Mvc; | |
using default_auth_review.Controllers; | |
namespace default_auth_review.Lib | |
{ | |
public class StubDependencyResolver : IDependencyResolver | |
{ | |
public object GetService(Type serviceType) |
This file contains hidden or 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
USE [my_database] | |
GO | |
/* Drop all non-system stored procs */ | |
DECLARE @name VARCHAR(128) | |
DECLARE @SQL VARCHAR(254) | |
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name]) | |
WHILE @name is not null | |
BEGIN |
This file contains hidden or 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
' This sample from Microsoft does not work on Windows 7 or Server 2008 | |
' Calls to OpenFile and WriteFile fail silently | |
' The API calls are supposedly supported in Win 7 and Win 8 | |
' Please offer any suggestions in comments | |
' Obtain a handle to the LPT1 parallel port. | |
hParallelPort = CreateFile("LPT1", GENERIC_READ Or GENERIC_WRITE, 0, IntPtr.Zero, _ | |
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero) | |
' Verify that the obtained handle is valid. |
This file contains hidden or 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
Leveling Up: When It's Time To Assume Technical Leadership | |
Most software developers would make lousy managers, but many of the experienced developers that I have met and worked with have more to offer in terms of technical leadership than they share with their managers and team. As an industry, we need you to leverage your experience for the benefit of us all. In this session we will examine some clues that you may be ready to "level up". We'll discuss when and how to appropriately exercise technical leadership and when to keep our mouths shut. | |
Attendees will leave this session with a toolkit of tactics to influence their teams, companies and clients to make better choices in the pursuit of greater user value. |
This file contains hidden or 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 bash | |
# | |
# execute this script with: | |
# curl https://raw.github.com/gist/2764397/gistfile1.sh | sudo bash | |
# | |
function add_user(){ | |
local user_name=$1 | |
local public_key=$2 |
This file contains hidden or 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 bash | |
# | |
# execute this script as root with: | |
# curl https://raw.github.com/gist/2123030/install_all.sh | bash -s MyAwesomeHostName | |
# | |
if [[ ! "root" = "$(whoami)" ]] ; then | |
echo -e "****\nThis script must be run as root.\n****" && exit 1 | |
fi |
This file contains hidden or 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/sh | |
# | |
# This shell script passes all its arguments to the binary inside the | |
# MacVim.app application bundle. If you make links to this script as view, | |
# gvim, etc., then it will peek at the name used to call it and set options | |
# appropriately. | |
# | |
# Based on a script by Wout Mertens and suggestions from Laurent Bihanic. This | |
# version is the fault of Benji Fisher, 16 May 2005 (with modifications by Nico | |
# Weber and Bjorn Winckler, Aug 13 2007). |