Skip to content

Instantly share code, notes, and snippets.

@devfred
devfred / gist:9802185560e9b0836a12fe8c8e158cf1
Created August 9, 2020 19:29 — forked from metavida/gist:601087
How to retrieve a Report record via the Haiku LMS API, using C#.
// Based on code from the following sources:
// * http://www.voiceoftech.com/swhitley/index.php/2009/03/twitter-oauth-with-net/
// * http://oauth.googlecode.com/svn/code/csharp/
// Note: if you're using mono the following command will compile this code `gmcs -r:System.Web.dll this_file.cs`
using System;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;
using System.Net;
@devfred
devfred / nginx.conf
Created November 16, 2016 08:56 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@devfred
devfred / haproxy.cfg
Created November 16, 2016 07:32 — forked from patmandenver/haproxy.cfg
haproxy with letsencrypt forwarding
global
log 127.0.0.1 syslog
maxconn 1000
user haproxy
group haproxy
daemon
defaults
log global
@devfred
devfred / nginx.conf
Created November 16, 2016 07:29 — forked from patmandenver/nginx.conf
nginx letsencrypt file
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
multi_accept on;
@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 / 01_sassygrid.scss
Created December 14, 2013 20:34 — forked from matthewcopeland/01_sassygrid.scss
01_sassygrid.scss
//---------------------------------------------------------------------------------------------------
// a sassier grid for spree
// fixed-width - html whitespace not removed.
// intended to be used as magic-classes, coupling markup&style.
// based on skeleton v1.1 by dave gamache - thanks dude
//
//---------------------------------------------------------------------------------------------------
//- Contents
//--- Grid classes
//--- Grid Variables
@devfred
devfred / example.html
Created May 21, 2013 15:53 — forked from joelnet/example.html
javascript: Unobtrusive knockout example
Choose a ticket class: <select id="tickets"></select>
<p id="ticketOutput"></p>
<script id="ticketTemplate" type="text/x-jquery-tmpl">
{{if chosenTicket}}
You have chosen <b>${ chosenTicket().name }</b>
($${ chosenTicket().price })
<button data-bind="click: resetTicket">Clear</button>
{{/if}}
<%@ 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 / 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/-->