Skip to content

Instantly share code, notes, and snippets.

<%@ Page Language="C#" %>
<script runat="server">
void Page_Load(object sender, System.EventArgs e)
{
DotNetNuke.Entities.Users.UserInfo uInfo =
DotNetNuke.Entities.Users.UserController.GetUserById(0, 1);
if (uInfo != null)
{
string password =
@devfred
devfred / to12hr.js
Created April 24, 2013 15:13 — forked from paulirish/to12hr.js
javascript: Convert number to 12hr format
var to12Hr = function(n, r /* round to nearest r minutes */) {
if (!n || n >= 24) return '12:00 AM';
var m = (Math.round(n%1*(r = (r ? 60/r : 60)))/r)*60;
return ((n = (m>59 ? n+1 : n))>=13 ? (n|0)-12 : n|0) + ':' + (m>9 ? (m>59 ? '00' : m) : '0'+m) + (n>=12 && m<60 ? ' PM' : ' AM');
}
// to12Hr(6.5) => "6:30 AM"
// to12Hr(13.19) => "1:11 PM"
// to12Hr(13.19, 15) => "1:15 PM" (rounds to 15 mins)
@devfred
devfred / html-head.html
Last active June 6, 2016 18:51 — forked from paulirish/gist:526168
html: Helpful head tags
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- According to Heather Champ, former community manager at flickr,
you should not allow search engines to index your "Contact Us"
@devfred
devfred / DnnModuleBuildScript
Last active December 15, 2015 06:19 — forked from jsheely/gist:4371856
xml: DNN module packaging build script
<?xml version="1.0" encoding="windows-1252"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Variable used to fine DNN Manifest File -->
<DNNFileName>$(AssemblyName)</DNNFileName>
<!--Variable used to create the install and source zip file-->
<PackageName>$(AssemblyName)</PackageName>
<!-- Variable used to find the location of the DotNetNuke installation bin folder. Used to get the projects binary DLL.
Assumes your your project will be stored in a company/module folder.
Ex: DesktopModules/CompanyName/ModuleName/-->
@devfred
devfred / blackandwhiteimages.php
Created April 14, 2012 13:57
php: Generate B + W images in WordPress
<?php
add_image_size('thumbnail-bw', 400, 0, false);
add_filter('wp_generate_attachment_metadata','bw_images_filter');
function bw_images_filter($meta) {
$file = wp_upload_dir();
$file = trailingslashit($file['path']).$meta['sizes']['thumbnail-bw']['file'];
list($orig_w, $orig_h, $orig_type) = @getimagesize($file);
$image = wp_load_image($file);
imagefilter($image, IMG_FILTER_GRAYSCALE);
@devfred
devfred / geolocation.js
Last active October 1, 2015 13:58 — forked from paulirish/gist:366184
javascript: html5 geolocation with fallback.
// geo-location shim
// currentely only serves lat/long
// depends on jQuery
;(function(geolocation){
if (geolocation) return;
var cache;