Skip to content

Instantly share code, notes, and snippets.

View wprater's full-sized avatar
💾
Building

Will Prater wprater

💾
Building
View GitHub Profile
@xdissent
xdissent / angular-ctrl.coffee
Last active December 18, 2015 00:39
AngularJS Controllers with Class in Coffeescript http://plnkr.co/rEYMsS0rKo1ZC6O5LoxM
class AngularCtrl
# The namespace to use for module name generation
@ns: 'ns.controllers'
# Module name for the exported Angular module, or autogenerated if `null`
@module: null
# An array of module names required by the controller
@require: []
@Bodacious
Bodacious / Rakefile
Created August 23, 2012 11:19
my Rakefile for lastest Rubymotion app
$:.unshift("/Library/RubyMotion/lib")
require File.join(File.dirname(__FILE__), 'version')
require 'motion/project'
require 'bundler'
Bundler.require
@emilbjorklund
emilbjorklund / breakpoints_via_css.html
Created April 24, 2012 16:03
Width detection via sneaky CSS rules
<!DOCTYPE html>
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>Breakpoint detection test</title>
<style type="text/css" media="screen">
@media screen and (min-width: 320px) {
#page:after {
content: 'smallest'; /* represent the current width-bracket */
@jkresner
jkresner / Procfile
Created April 13, 2013 09:05
Deploy brunch to heroku
web: ./node_modules/.bin/coffee app.coffee
@jonhyman
jonhyman / BSONIdGenerator.h
Last active April 17, 2018 18:32
BSON Object Id generator in Objective-C
/*
# Copyright 2018 Jon Hyman
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@asmallteapot
asmallteapot / rbm_singleton.rb
Created September 20, 2012 18:00
Singletons in RubyMotion 1.4
# http://blog.rubymotion.com/post/31917526853/rubymotion-gets-ios-6-iphone-5-debugger
class STSomeAPIClient
def self.sharedClient
Dispatch.once { @instance ||= new }
@instance
end
end
@SzymonMrozek
SzymonMrozek / ConstraintsOperators.swift
Last active November 28, 2019 18:50
Set of useful operators for more readable creation of constraints
import UIKit
import Foundation
infix operator ~ : RangeFormationPrecedence
public enum AnchorOption: Hashable {
case priority(UILayoutPriority)
case multiplier(CGFloat)
case constant(CGFloat)
@igrigorik
igrigorik / file.html
Created July 6, 2012 08:01
Example of early head flush on load time
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Hello</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
Hello World
</body>
@WebReflection
WebReflection / certificate.sh
Last active July 1, 2020 18:08
A basic Self Signed SSL Certificate utility
#!/usr/bin/env bash
# A basic Self Signed SSL Certificate utility
# by Andrea Giammarchi @WebReflection
# https://www.webreflection.co.uk/blog/2015/08/08/bringing-ssl-to-your-private-network
# # to make it executable and use it
# $ chmod +x certificate
# $ ./certificate # to read the how-to
@Gaya
Gaya / hoc.js
Last active February 16, 2021 10:09
Pure Component HOC in React
import React from 'react';
const someProp = 'We want to pass this as a prop';
// hip and short notation
export const wrapComponent = (UncomposedComponent) => (props) => <UncomposedComponent {...props} someProp={someProp} />;
// Or broken down:
// a factory which wraps a component