RubyMotion projects can be extended through the use of RubyGems, the Ruby de-facto packaging system. This article will cover how to write RubyMotion-specific gems.
This article was inspired by Create gems for RubyMotion, by Francis Chong.
RubyMotion projects can be extended through the use of RubyGems, the Ruby de-facto packaging system. This article will cover how to write RubyMotion-specific gems.
This article was inspired by Create gems for RubyMotion, by Francis Chong.
##Userable | |
module Userable | |
def self.included(base) | |
base.has_one :user, :as => :userable, :dependent => :destroy, :autosave => true | |
base.validate :user_must_be_valid | |
base.alias_method_chain :user, :autobuild | |
base.extend ClassMethods | |
base.define_user_accessors | |
end | |
org_posts_dir = "org_posts" # directory under source | |
# From http://www.ewal.net/2012/09/08/octopress-customizations/ | |
# Modified to have default flag of true to include drafts | |
desc "Rename files in the posts directory if the filename does not match the post date in the YAML front matter" | |
task :rename_posts do | |
rename_posts_in_dir "#{source_dir}/#{posts_dir}", "markdown" | |
# remove next line if you're you're not using org-mode | |
rename_posts_in_dir "#{source_dir}/#{org_posts_dir}", "org" |
# -*- coding: utf-8 -*- | |
$:.unshift("/Library/RubyMotion/lib") | |
require 'motion/project/template/osx' | |
Motion::Project::App.setup do |app| | |
# Use `rake config' to see complete project settings. | |
app.name = 'MenubarApp' | |
app.info_plist['NSUIElement'] = 1 | |
end |
# From the tty_ioctl man page in Linux. | |
# | |
# TIOCGWINSZ struct winsize *argp | |
# Get window size. | |
# | |
# TIOCSWINSZ const struct winsize *argp | |
# Set window size. | |
# | |
# The struct used by these ioctls is defined as | |
# |
## PERFORMANCE (1/7/13) | |
# | |
# CONGRATULATIONS! You have climbed to the top of the tower and rescued the fair maiden Ruby. | |
# Your average grade for this tower is: A | |
# | |
# Level 1: S | |
# Level 2: A | |
# Level 3: A | |
# Level 4: B | |
# Level 5: A |
// ==UserScript== | |
// @name ${1:Some fancy name} | |
// @namespace ${2:https://gist.github.com/9665787} | |
// @version 0.1 | |
// @description ${3:Some description} | |
// @match /* ALLOW TAMPERMONKEY TO FILL THIS IN *OR* COPY FROM TAMPERMONKEY */ | |
// @copyright 2014+, ${4:Gustavo Keener} | |
// ==/UserScript== | |
// Add jQuery, unless it already exists |
require 'non_digest_assets' | |
namespace :assets do | |
task :non_digested do | |
NonDigestAssets.new.generate | |
end | |
end |
module LiquidPresenters | |
class Plan < SimpleDelegator | |
def to_liquid | |
@to_liquid ||= HashWithIndifferentAccess.new({ | |
id: self.id, | |
name: self.name, | |
description: self.description, | |
status: self.status, | |
class_id: self.plan_class_id | |
}) |
GitHub Wiki updated Bookmarklet (Sep 2014)
Note: Will not work with Firefox, see bug #866522
Wiki - Hides extra panels:
javascript:(function(e,a,g,h,f,c,b,d)%7Bif(!(f=e.jQuery)%7C%7Cg%3Ef.fn.jquery%7C%7Ch(f))%7Bc=a.createElement(%22script%22);c.type=%22text/javascript%22;c.src=%22https://ajax.googleapis.com/ajax/libs/jquery/%22+g+%22/jquery.min.js%22;c.onload=c.onreadystatechange=function()%7Bif(!b&&(!(d=this.readyState)%7C%7Cd==%22loaded%22%7C%7Cd==%22complete%22))%7Bh((f=e.jQuery).noConflict(1),b=1);f(c).remove()%7D%7D;a.documentElement.childNodes%5B0%5D.appendChild(c)%7D%7D)(window,document,%221.3.2%22,function($,L)%7B$('%23header,%20.pagehead,%20.breadcrumb,%20.commit,%20.meta,%20%23footer,%20%23footer-push,%20.wiki-actions,%20%23last-edit,%20.actions,%20.header,%20%23wiki-rightbar,%20.gh-header-actions,%20.sunken-menu-contents,%20.site-footer').remove();%20$('%23files,%20.file').css(%7B%22background%22:%22none%22,%20%22border%22:%22none%22%7D