Skip to content

Instantly share code, notes, and snippets.

View smockle's full-sized avatar

Clay Miller smockle

View GitHub Profile
@andrewbranch
andrewbranch / BundleConfig.cs
Last active December 21, 2015 11:38
Bundling with BundleTransformer in ASP.NET MVC. Less files need to have their Build Action set to "Content" in their file properties in order to publish successfully.
using System.Web;
using System.Web.Optimization;
using BundleTransformer.Core.Transformers;
namespace Project {
public class BundleConfig {
public static void RegisterBundles(BundleCollection bundles) {
@andrewbranch
andrewbranch / getAuburnBuildings.js
Last active December 21, 2015 04:59
Gets an array of Auburn building names from the web API. Works from auburn.edu domain and subdomains.
var auburnBuildingNames;
window.getAuburnBuildingNames = function(callback) {
if (auburnBuildingNames) {
callback(auburnBuildingNames);
} else {
var buildings;
$.getJSON("https://cws.auburn.edu/map/api/3.0/building", function(data) {
buildings = $.map(data, function(building, i) {
return building.name;
@natchiketa
natchiketa / yo-completion.sh
Last active May 25, 2018 20:47
Bash completion for Yeoman generators
# Bash completion for Yeoman generators - tested in Ubuntu, OS X and Windows (using Git bash)
function _yo_generator_complete_() {
# local node_modules if present
local local_modules=$(if [ -d node_modules ]; then echo "node_modules:"; fi)
# node_modules in /usr/local/lib if present
local usr_local_modules=$(if [ -d /usr/local/lib/node_modules ]; then echo "/usr/local/lib/node_modules:"; fi)
# node_modules in user's Roaming/npm (Windows) if present
local win_roam_modules=$(if [ -d $(which yo)/../node_modules ]; then echo "$(which yo)/../node_modules:"; fi)
# concat and also add $NODE_PATH
local node_dirs="${local_modules}${usr_local_modules}${win_roam_modules}${NODE_PATH}"
// jonathantneal's polyfill for matchesSelector
if (this.Element) function(ElementPrototype) {
ElementPrototype.matches = ElementPrototype.matchesSelector =
ElementPrototype.matchesSelector ||
ElementPrototype.webkitMatchesSelector ||
ElementPrototype.mozMatchesSelector ||
ElementPrototype.msMatchesSelector ||
ElementPrototype.oMatchesSelector ||
function (selector) {
var nodes = (this.parentNode || this.document).querySelectorAll(selector), i = -1;
@smockle
smockle / Fields.rb
Last active December 17, 2015 11:29
Fields lists Rails database column types.
# DATABASE TYPES
# eg. field_name:field_type
:string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean, :references
@TheTfactor
TheTfactor / PDF Display Notes.cs
Created April 17, 2013 14:17
PDF display options. Prevents autodownloading.
HttpContext.Current.Response.BufferOutput = true;
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.AddHeader("Cache-control", "no-store");
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline; filename=\"" + fileName + "\"");
HttpContext.Current.Response.ContentType = dr["MimeType"].ToString();
HttpContext.Current.Response.AddHeader("Content-Length", fileblob.Length.ToString());
HttpContext.Current.Response.BinaryWrite(fileblob);
HttpContext.Current.Response.Flush();
HttpContext.Current.ApplicationInstance.CompleteRequest();
@eclosson
eclosson / pdf_merger.rb
Created January 11, 2013 18:29
Merging PDFs with Prawn
class PdfMerger
def merge(pdf_paths, destination)
first_pdf_path = pdf_paths.delete_at(0)
Prawn::Document.generate(destination, :template => first_pdf_path) do |pdf|
pdf_paths.each do |pdf_path|
pdf.go_to_page(pdf.page_count)
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
ServerName pow
ServerAlias *.dev
ServerAlias *.xip.io
ProxyPass / http://localhost:20559/
ProxyPassReverse / http://localhost:20559/
ProxyPreserveHost On
@stormsilver
stormsilver / unbundled_require.rb
Created October 15, 2012 19:59 — forked from zaius/unbundled_require.rb
Allow requiring of global gems from outside of the Gemfile
# Include this in your .irbrc
def unbundled_require(gem, options = {})
if defined?(::Bundler)
spec_path = Dir.glob("#{Gem.dir}/specifications/#{gem}-*.gemspec").last
if spec_path.nil?
warn "Couldn't find #{gem}"
return
end
spec = Gem::Specification.load spec_path
@xavierdecoster
xavierdecoster / register a myget feed.markdown
Last active July 12, 2022 12:43
Store MyGet credentials in your roaming user profile NuGet.config

Execute the following script using your MyGet [feedUrl] and MyGet [username] , [password] and [apikey]. Run this from a commandline where you have access to nuget.exe (or set the path to your nuget.exe in a system environment variable).

Store credentials in machine-level nuget.config (non-transferable)

nuget setapikey [apikey] -source [feedUrl]
nuget sources add|update -Name [name] -source [feedUrl] -User [username] -pass [password]