Skip to content

Instantly share code, notes, and snippets.

View distractdiverge's full-sized avatar

Alex (Allie) Lapinski distractdiverge

View GitHub Profile
@distractdiverge
distractdiverge / gist:3982098
Created October 30, 2012 18:32
Clear Persistent Store
-(void) resetPersistentStore
{
NSURL* storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"Model.sqlite"];
NSPersistentStore* store = [_persistentStoreCoordinator persistentStoreForURL:storeURL];
NSError* error = nil;
[_persistentStoreCoordinator removePersistentStore:store error:&error];
if (error) {
@distractdiverge
distractdiverge / gist:5263803
Created March 28, 2013 14:58
.NET Settings File - JSON
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute(@"{""values"":[""sitecore/data"", ""/sitecore/web/client specific pages}")]
public IEnumerable<string> SiteSearchExclusionPaths
{
get
{
JObject o = JObject.Parse((string) this["SiteSearchExclusionPaths"]);
return (IEnumerable<string>)((JArray)o["values"]).AsEnumerable();
}
@distractdiverge
distractdiverge / XCodeReporter.js
Last active June 8, 2016 18:08
A custom reporter for jshint to present errors in a format for XCode to read them.
module.exports = {
reporter: function (res) {
var len = res.length;
var str = "";
res.forEach(function (r) {
var file = r.file;
var err = r.error;
str += file + ":" + err.line + ": error: " + err.reason + "\n";
@distractdiverge
distractdiverge / _layout-scaffolding.scss
Created January 29, 2014 23:14
Susy Custom Breakpoints to ease individual grid settings per breakpoint
@import "susy";
// All of the em-based layouts assume 16 pixels as base font size
// Mobile First (i.e. Default Grid Settings)
$total-columns : 4; // 4 columns on mobile
$column-width : 4.25em; // ~= 68 pixels
$gutter-width : 1em; // ~= 16 pixel wide gutter between mobile columns
$grid-padding : 0; // No Padding with susy
@distractdiverge
distractdiverge / _layout-scaffolding.scss
Created February 11, 2014 14:32
Abstracted Mixins for Responsive Sass (Desktop First)
@include 'compass';
@include 'breakpoint';
//
// Note all breakpoints are specified in Pixels, but Breakpoint will convert this to EMs for us.
//
$breakpoint-to-ems: true;
@mixin at-mobile-breakpoint() {
@distractdiverge
distractdiverge / _mixins.bidirectional.scss
Last active August 29, 2015 13:56
SASS Mixin for BiDirectional Styles controlled via html[dir]
//
// BiDirectional Style Helper
// @description This mixin is designed to flip the property for right to left languages when needed.
// Determiniation of which style is included in the generated CSS is controled by a global variable to set the language direction.
//
// @param $property The LTR css property to set
// @param $value The value to use for the LTR css property
// @param $inverse-property (optional) The RTL css property to set (e.g. margin-right instead of margin-left).
// @param $inverse-value (optional) The RTL value of the $inverse-property (if set), or of the LTR css $property.
// @param $default-value (optional) The default LTR value for $property. This is required if $inverse-property is different than $property.
html, body{
height:150%;
}
.floating-isi {
background: #85144B;
position:fixed;
bottom:0;
height:30%;
color:White;
@distractdiverge
distractdiverge / gist:18f854c88ed774d647a2
Created August 13, 2014 17:41
Open Windows & Redirect / Close
function openWindowsAndRedirectTo(windows, url) {
var _windows = windows,
_len = function() { _windows.length; };
for( var i = 0, len = _len(); i < len; i++ ) {
_windows[i] = {
url: _windows[i],
instance: null
};
_windows[i].instance = window.open(_windows[i]);
@distractdiverge
distractdiverge / backup.sh
Created September 30, 2014 17:40
MongoDB Backup Example (run by crontab)
mongodump —out /home/node/data-backups/`date “+%Y-%m-%d-TIME-%H-%M-%S”`
@distractdiverge
distractdiverge / DefaultEmailProvider.cs
Last active August 29, 2015 14:07
ASP.NET MVC Razor Template Emails
using System;
using System.Net.Mail;
namespace Client.Project.Repository.Services
{
public class DefaultEmailProvider : IEmailProvider
{
private const int DEFAULT_PORT = 25;
private readonly int _smptServerPort;