Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bardware's full-sized avatar

Bernhard Döbler bardware

View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Custom Error Objects in JavaScript</title>
</head>
<body>
<h1>Custom Error Objects in JavaScript</h1>
@rc1
rc1 / otf2ttf2eot.sh
Created April 9, 2013 14:49
Converts OpenType fonts file to an Embedded OpenType file on the Mac. Tools installed via homebrew on Mac.
#!/bin/sh
# Convert an OTF font into TTF an EOT formats.
# @source: http://stackoverflow.com/a/2467452/179015
# @note: brew install fontforge
# brew install
# @usage: sh otf2ttf2eot.sh FontName
otfFont="$1.otf"
ttfFont="$1.ttf"
eotFont="$1.eot"
fontforge -c '
@coolya
coolya / gist:3551118
Created August 31, 2012 10:13
EnumerableExtensions.cs
public static class EnumerableExtensions
{
public static BlockingCollection<T> CopyToBlockingCollectionAsync<T>(this IEnumerable<T> source)
{
var collection = new BlockingCollection<T>();
Task.Factory.StartNew(() =>
{
foreach (var item in source)
{
@davidpett
davidpett / filesize_helper.js
Created October 31, 2013 22:17
filesize handlebars helper
Ember.Handlebars.helper('filesize', function(value) {
if (typeof value === 'undefined') {
return null;
}
var i,
filesize,
units = ['B', 'KB', 'MB', 'GB', 'TB'];
for (i = 0; i < units.length; i++) {
if (value < 1024) {
filesize = Math.floor(value) + units[i];
Application.cfc
component extends=framework.one {
this.ormenabled = true;
this.datasource = "store";
this.ormSettings.dbCreate = "dropcreate";
this.ormSettings.logsql = true;
this.ormSettings.dialect = "Oracle10g";
variables.framework.reloadApplicationOnEveryRequest = true;
@JefClaes
JefClaes / gist:c25e90d01b5a376e4e0a
Last active April 26, 2017 20:56
Force create LocalDB database
using (var conn = new SqlConnection(@"Data Source=(LocalDb)\v11.0;Initial Catalog=Master;Integrated Security=True"))
{
conn.Open();
var cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = string.Format(@"
IF EXISTS(SELECT * FROM sys.databases WHERE name='{0}')
BEGIN
ALTER DATABASE [{0}]
@tonyjunkes
tonyjunkes / .htaccess
Created June 26, 2013 01:25
Apache Mod_Rewrite .htaccess example to rewrite a FW/1 Subsystem URL to be SES and rewrite to remove index.cfm from URLs. Replace the example Subsystem (admin) with the actual Subsystem to be rewritten.
RewriteEngine On
#Rewrite FW/1 Subsystem
RewriteRule ^admin/(.*)$ index.cfm/admin:$1 [L]
#Rewrite index.cfm
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^.*\.(bmp|css|gif|htc|html?|ico|jpe?g|js|pdf|png|swf|txt|xml)$
RewriteRule ^(.*)$ index.cfm/$1 [NS]
@MonkeyDo
MonkeyDo / links.less
Last active May 17, 2017 09:03
Bootstrap 3 less file for styling :visited links
@mhayes
mhayes / dsn-listing.cfm
Created January 3, 2011 15:47
List DSN's that exist on a particular server
<h2>Server: <cfoutput>#CGI.SERVER_NAME#</cfoutput></h2>
<p>
The following ColdFusion DSN's are available on this server:
</p>
<cfscript>
// Instantiate CF Admin API
adminObj = createObject("component","cfide.adminapi.administrator");
@wilgeno
wilgeno / testClearCache.cfm
Last active July 10, 2017 09:44
CF 2016 clearTrustedCache
<cfscript>
adminUser = "admin";
adminPW = "password";
thefile = "/absolute/path/to/file.cfm";
adminObj = createObject("component","cfide.adminapi.administrator");
adminObj.login(adminPW, adminUser);
adminRuntime = createObject("component","cfide.adminapi.runtime");
adminRuntime.clearTrustedCache(thefile);
</cfscript>