Skip to content

Instantly share code, notes, and snippets.

@atheken
atheken / TranslateResizeMaskToConstraints.swift
Last active August 29, 2015 14:14
Make "TranslatesAutoresizingMaskIntoConstraints" a drop-down in Interface Builder.
@IBDesignable
class TranslateResizeMaskToConstraints: UIView {
@IBInspectable var Enabled:Bool = false
private var _interfaceBuilderContext = false
override func awakeFromNib() {
super.awakeFromNib()
setTranslatesAutoresizingMaskIntoConstraints(Enabled || _interfaceBuilderContext)
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>
///<summary>Allows slim locks to be requesed using(LOCK.WriteLock()){ ... } syntax</summary>
public static class LockExtensions
{
public class DisposableCallback : IDisposable
{
public void Dispose ()
{
_callback ();
}
@atheken
atheken / FontCreator.cs
Created June 14, 2014 12:19
Xamarin iOS FontLoader for more fluent font creation/management.
public class FontCreator
{
private string _fontName;
private Dictionary<float, UIFont> _lookup = new Dictionary<float, UIFont> ();
public FontCreator (string fontName)
{
_fontName = fontName;
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using MonoTouch.UIKit;
using System.Reflection;
using MonoTouch.Foundation;
namespace Praeclarum.UI
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using MonoTouch.UIKit;
namespace Async.iOS
{
public static class Layout
{
@atheken
atheken / jade_shim.js
Created August 27, 2013 00:51
When you pre-compile your jade templates for the browser, interpolated locals will still require jade.escape, but it's a simple fix, and here it is!
// this is required in order to properly escape
// jade interpolation
jade = {
escape: function(html){
return String(html)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
}
@atheken
atheken / grunt_supervisor.js
Last active December 21, 2015 18:19
Stupid simple spawn, allows for supervisor to be run and prevents it from being restarted each time.
var proc = null;
grunt.registerTask('supervisor', function(){
if(!proc){
proc = grunt.util.spawn(this.options());
}
});
grunt.initConfig({
supervisor : {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using MonoTouch.UIKit;
namespace Async.iOS
{
public static class Layout
{
@atheken
atheken / evaluate_cs.cs
Created January 1, 2013 21:50
Is this how you use mono's evaluator?
public static dynamic ParseFunc (string func, out string error)
{
dynamic retval = null;
error = null;
using (var ms = new MemoryStream()) {
using(var tr = new StreamWriter(ms)){
var settings = new CompilerSettings();