Skip to content

Instantly share code, notes, and snippets.

// how to programatically create NSLayoutConstraints inside a playground
import UIKit
let viewFrame = CGRect(x: 0, y: 0, width: 640, height: 750)
let view = UIView(frame: viewFrame)
view.backgroundColor = UIColor.greenColor()
// initially the subView will obscure the entire view
let subView = UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffectStyle.Dark))
// in a UITableViewController (or any other view controller with a UITableView)
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, 0)];
header.translatesAutoresizingMaskIntoConstraints = NO;
// [add subviews and their constraints to header]
NSLayoutConstraint *headerWidthConstraint = [NSLayoutConstraint
// Auto layout in a Swift Playground (for iOS).
import UIKit
var v = UIView()
v.frame = CGRectMake(0, 0, 200, 200)
var b1 = UIButton()
b1.setTitle("Click Me", forState:UIControlState.Normal)
b1.setTitleColor(UIColor.blueColor(), forState: UIControlState.Normal)
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Android
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8">-->
<!-- iPad/iPhone specific css below, add after your main css >
#Create a new file in your home directory called .gtkrc-eclipse
# call eclipse with this command:
# env GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc:/home/USER/.gtkrc-eclipse '/path_to_eclipse/eclipse'
# In your Eclipse directory find the file 'plugins/org.eclipse.platform_4.2.*/css/e4_default_gtk.css'
# (there's an * in there, because I guess that the version may change in the future or may be different already).
# In this file there's a CSS class:
#.MPartStack {
@fdln
fdln / Custom.css
Created January 19, 2014 07:03 — forked from drewwells/Custom.css
/**********************************************/
/*
/* Solarized Dark Skin by Mark Osborne - 2011
/*
/* Based on IR_Black Skin by Ben Truyman:
/* https://gist.github.com/1245727
/*
/* and Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
@fdln
fdln / purge.sh
Created January 8, 2014 17:02 — forked from ekinertac/purge.sh
#!/bin/bash
# Free unused memory
flush_mem () {
sync
echo 3 | tee /proc/sys/vm/drop_caches
}
echo -e "\nMemory usage before purge:\n" && free -m
--- base64.lua
--
-- https://gist.github.com/2563975
--
-- V0.3 for Lua 5.1
--
-- A simple Base64 encoder/decoder that uses a URL safe variant of the standard.
-- This implementation encodes character 62 as '-' (instead of '+') and character 63 as '_' (instead of '/').
-- In addition, padding is not used by default.
-- A full description of the specification can be found here: http://tools.ietf.org/html/rfc4648
--- Animal.lua
--
-- A simple example of a base class usng the classes library.
--
-- @author PaulMoore
--
-- Copyright (C) 2011 by Strange Ideas Software
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal