Skip to content

Instantly share code, notes, and snippets.

View plcancelleri's full-sized avatar
🦏
...

P. L. Cancelleri plcancelleri

🦏
...
View GitHub Profile
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@jkeefe
jkeefe / kml-ordering.js
Created August 25, 2011 06:28
Making sure KML layers display in order
// Set the KML path
kml_path = "http://www.nhc.noaa.gov/storm_graphics/api/AL092011_019adv_"
// Load the KML files (must be publically available)
coneLayer = new google.maps.KmlLayer(
kml_path + "CONE.kmz",
{preserveViewport: true}
);
@nfarina
nfarina / UIView+FrameAdditions.h
Created August 21, 2012 06:40
UIView Frame helper getter/setter category methods
#import <UIKit/UIKit.h>
@interface UIView (SMFrameAdditions)
@property (nonatomic, assign) CGPoint $origin;
@property (nonatomic, assign) CGSize $size;
@property (nonatomic, assign) CGFloat $x, $y, $width, $height; // normal rect properties
@property (nonatomic, assign) CGFloat $left, $top, $right, $bottom; // these will stretch the rect
@end
@joshfinnie
joshfinnie / gist:4046138
Created November 9, 2012 14:54
Installing Mezzanine on Heroku

Lately, I have been looking into Python CMSs. There are many out there, but for some reason or another Mezzanine stuck out as one I should try. Installing it is easy enough, but getting it up on running on my new favorite host, Heroku, was a bit of a challege.

Below you will find the steps that I took to get Mezzanine up and running on Heroku. Please let me know in the comments below if anything didn't work for you.

Setting up the Database

Heroku is shortly depricating Django's standard DATABASES dictionary in favor for a package which takes OS Environment Variables and builds the required dictionary for you. This is a good thing because it makes setting up a database on Heroku very easy. The package is called dj_database_url and it makes short work of getting a PostgreSQL database up and running with Mezzanine. Below is the code that you want to put in Mezzanine's DATABASES section:

import dj_database_url
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
@kbrammer
kbrammer / LINQPadSearchFileContents.cs
Created May 3, 2013 18:09
Extension methods to enumerate files and directories, include or exclude by name or extension, and search file contents. Example is in LINQPad format.
void Main()
{
string path = Path.GetFullPath(@"C:\Users\Username");
System.IO.DirectoryInfo di = new DirectoryInfo(path);
var query = di.GetFiles("*.*",SearchOption.TopDirectoryOnly).IncludeFileExtensions("*.asp").SearchFileContents("searchterm");
query.Dump();
}
public static class FileIOExtensions
@swlaschin
swlaschin / type-dependency-graph.fsx
Last active July 23, 2024 10:36
This script analyzes the dependencies between top level types in a .NET Assembly. It is then used to compare the dependency relationships in some F# projects with those in some C# projects.
(*
This script analyzes the dependencies between top level types in a .NET Assembly.
It is then used to compare the dependency relationships in some F# projects with those in some C# projects.
Note that no attempt has been made to optimize the code yet!
REQUIRES:
* Mono.Cecil for code analysis
From http://www.mono-project.com/Cecil#Download
@ijy
ijy / sublime-text-3-setup.md
Last active January 15, 2024 14:21
My Sublime Text 3 setup.

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
@mikeminutillo
mikeminutillo / gist:8346775
Created January 10, 2014 03:58
Embed Google Chart API graph into LINQPad Results window
Util.RawHtml(@"<script type=""text/javascript"" src=""https://www.google.com/jsapi""></script>").Dump();
Util.RawHtml(@"<div id=""chart_div"" style=""width: 1024px; height: 1024px;""></div>").Dump();
var script = new StringBuilder();
script.AppendLine(@"
<script type=""text/javascript"">
google.load(""visualization"", ""1"", {packages:[""corechart""]});
google.setOnLoadCallback(drawChart);
function drawChart() {
@staltz
staltz / introrx.md
Last active July 25, 2024 16:52
The introduction to Reactive Programming you've been missing
@BryanWilhite
BryanWilhite / sample.cs
Created January 20, 2016 00:34
LinqPad: Animation Study
void Main()
{
var xaml = @"
<UserControl
xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
xmlns:sys=""clr-namespace:System;assembly=mscorlib"">
<UserControl.Resources>
<Style TargetType=""{x:Type Button}"">
<Setter Property=""Height"" Value=""32"" />