Skip to content

Instantly share code, notes, and snippets.

View jemgold's full-sized avatar
👽
vibing

Jem jemgold

👽
vibing
View GitHub Profile
@jemgold
jemgold / classWithIvar.cocoascript.js
Last active March 21, 2017 05:04 — forked from darknoon/classWithIvar.cocoascript.js
You can use ivars so you don't need to make so many hilarious classes
class Class {
constructor(ivars = []) {
const uniqueClassName = "fetchDelegate_" + NSUUID.UUID().UUIDString();
const cls = MOClassDescription.allocateDescriptionForClassWithName_superclass_(uniqueClassName, NSObject);
const prototype = Object.getPrototypeOf(this);
Object.getOwnPropertyNames(prototype).forEach(prop => {
console.log(prop);
const sel = NSSelectorFromString(prop);
cls.addInstanceMethodWithSelector_function_(sel, prototype[prop]);
@jemgold
jemgold / classWithIvar.cocoascript.js
Created March 21, 2017 04:59 — forked from darknoon/classWithIvar.cocoascript.js
You can use ivars so you don't need to make so many hilarious classes
// Make a class with some handlers.
function Class(handlers){
var uniqueClassName = "fetchDelegate_" + NSUUID.UUID().UUIDString();
var cls = MOClassDescription.allocateDescriptionForClassWithName_superclass_(uniqueClassName, NSObject);
// Add each handler to the class description
for(var selectorString in handlers) {
var sel = NSSelectorFromString(selectorString);
cls.addInstanceMethodWithSelector_function_(sel, handlers[selectorString]);
}
// Add ivar to store instance-specific info
@jemgold
jemgold / ShareButton.jsx
Created May 17, 2016 16:54 — forked from jamesslock/ShareButton.jsx
ReactJS Share Buttons
import React, { PropTypes } from 'react';
import Button from '../components/Button.jsx';
import Icon from '../components/Icon.jsx';
module.exports = React.createClass({
render: function () {
const {
className,
classNameIcon,
children,
@jemgold
jemgold / vr.scss
Last active August 29, 2015 13:59 — forked from ry5n/-ry5n-vertical-rhythm
// Configurable variables
// ⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻
// Absolute height of body text, in pixels
$base-font-size: 16px !default;
// Absolute height of one line of type, in pixels
$base-line-height: 24px !default;
// The font unit to use when returning values in rhythm functions
App.RadClass = Em.Object.extend(
itemId: ((key, value)->
if arguments.length == 2 and value
name = value.split(' ')
@set('firstName', name[0])
@set('lastName', name.slice(1).join(' '))
if @get('firstName') or @get('lastName')
"#{@get('firstName')} #{@get('lastName')}"
else
/*
ISO 216 paper sizes converted to pixels @ 300dpi
Drop this file in your Processing sketch and use like so: size(A1w, A1h);
*/
final int A5w = 1748;
final int A5h = 2480;
final int A4w = 2480;
# config/initializers/
Mongoid::Document.send(:include, ActiveModel::SerializerSupport)
Mongoid::Criteria.delegate(:active_model_serializer, to: :to_a)
@jemgold
jemgold / eden.scss
Created November 7, 2012 16:20 — forked from daneden/gist:4032573
Sass media queries and @extend
// Fairly safe way to visually hide content, but make it accessible to screen readers
.visually-hidden {
position: absolute;
left: -9999px;
height: 1px;
}
.mobile-offscreen {
@media screen and (max-width: 700px) {
@extend .visually-hidden;
directory "tmp"
file "tmp/hello.tmp" => "tmp" do
sh "echo 'Hello' > 'tmp/hello.tmp'"
end
task :default => 'morning:turn_off_alarm'
namespace :morning do
desc "Turn off alarm."