Skip to content

Instantly share code, notes, and snippets.

View adamkdean's full-sized avatar

Adam K Dean adamkdean

View GitHub Profile
$(function() {
// Tweaked from: https://gist.github.com/mattstauffer/3835881
// No guarantees
// 1. include Isotope.js
// 2. include this file
// 3. customize Isotope options at the bottom of this file
// 4. add "margin: 0 auto" to the isotope container
$.Isotope.prototype._getMasonryGutterColumns = function() {
@adamkdean
adamkdean / gist:9197523
Created February 24, 2014 21:27
requestAnimFrame
DisplayEngine.prototype.loop = function(instance) {
instance.update();
instance.draw();
this.requestAnimFrame.call(window, function() {
instance.loop(instance);
});
}
@adamkdean
adamkdean / gist:9226944
Created February 26, 2014 10:03
Dynamic widths with CSS
<!doctype html>
<html lang="en">
<head>
<style>
.container {
width: 80%;
}
.left {
float: left;
width: 300px;
@adamkdean
adamkdean / gist:9366062
Last active August 29, 2015 13:57
LocalFileModule
/*
* LocalFileModule
*
* This service will, for now, allow you to upload local files and
* return a string of what they contain.
*
*/
angular.module('LocalFileModule', [])
@adamkdean
adamkdean / gist:9503334
Created March 12, 2014 09:03
Closure compiler
// ==ClosureCompiler==
// @compilation_level WHITESPACE_ONLY
// @output_file_name default.js
// @formatting pretty_print
// ==/ClosureCompiler==
// ADD YOUR CODE HERE
/*
* LocalFileModule
*
@adamkdean
adamkdean / gist:9503341
Last active August 29, 2015 13:57
Closure compiler test
angular.f("LocalFileModule",[]).g("localFileService",[function(){function h(d,e,f){var g=new FileReader;d=d.target.files;0<d.length&&(g.onload=function(d){e(d.target.result)},g.onerror=function(d){f(d)},g.readAsText(d[0]))}function k(d){d=document.getElementById(d);var e=document.createElement("input");e.type="file";e.id=d.id;e.name=d.name;e.className=d.className;e.style.cssText=d.style.cssText;d.parentNode.replaceChild(e,d)}return{isSupported:window.a&&window.c&&window.b&&window.Blob,d:function(d,
e){document.getElementById(d).addEventListener("change",e,!1)},e:function(d,e,f){k(d);document.getElementById(d).addEventListener("change",function(d){h(d,e,f)},!1)}}}]);
using System;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
var path = string.Format("C:\\Users\\Adam\\Desktop\\test{0}.xls", DateTime.Now.ToString(("hhmmss")));
var csv = "Test A,1\r\nTest B,2\r\nTest C,3\r\nTest D,4";
var properites = new CSV2XLS.ColumnProperties[] {
new CSV2XLS.ColumnProperties { ColumnWidth = 16 },
new CSV2XLS.ColumnProperties { ColumnWidth = 16, NumberFormat = "0" }
};
CSV2XLS.ConvertToXLS(csv, path, properites);
using System;
using System.IO;
using System.Reflection;
using Excel = Microsoft.Office.Interop.Excel;
namespace CSV2XLS
{
class CSV2XLS
{
public struct ColumnProperties
return (isNaN(ai) || isNaN(bi))
? a > b
? 1
: a < b
? -1
: 0
: ai > bi
? 1
: ai < bi
? -1