Skip to content

Instantly share code, notes, and snippets.

View andrewhavens's full-sized avatar

Andrew Havens andrewhavens

View GitHub Profile
@jbender
jbender / cell_layout.rb
Created April 29, 2016 17:25
MotionKit Cells
class CellLayout < MotionKit::Layout
include CommonStyles
def layout
root :cell do
add contentView, :content_view do
add(UIView, :container) { cell_content_layout }
end
end
end
@amirrajan
amirrajan / usage.rb
Last active March 24, 2016 11:38
Poor Man's Android View Generation with RM
class MainActivity < Android::App::Activity
include ViewGeneration
def generate_screen
root_view(
horizontal_layout(:row0, text_view(:title, "a dark room")),
horizontal_layout(:row1,
hidden_button(:outside_button, "a silent forest"),
hidden_button(:embark_button, "a dusty path")
),
@jamonholmgren
jamonholmgren / app_delegate.rb
Created May 13, 2015 21:13
RubyMotion async module that gives a pretty syntax.
class AppDelegate
include Async
def application(application, didFinishLaunchingWithOptions:launchOptions)
thread_1 = async do
i = 0
300_000.times do
sleep 0.000001
@blacktm
blacktm / install_ruby_rpi.sh
Last active November 28, 2024 20:35
A Bash script to install Ruby on the Raspberry Pi
#!/bin/bash
# --------------------------------------------------------------------------------------------
# Installs Ruby using rbenv/ruby-build on the Raspberry Pi (Raspbian)
#
# Run from the web:
# bash <(curl -s https://gist.githubusercontent.com/blacktm/8302741/raw/install_ruby_rpi.sh)
# --------------------------------------------------------------------------------------------
# Set the Ruby version you want to install
@tlrobinson
tlrobinson / post-receive
Last active December 7, 2022 08:15
Super simple git post-receive hook for Node.js + nvm + npm + node-foreman + init (Ubuntu) deployment
#!/usr/bin/env bash
set -u
set -e
export GIT_WORK_TREE="/var/www/example.com"
export NODE_VERSION="0.10"
echo "--> Checking out..."
git checkout -f
@rjsamson
rjsamson / Rakefile
Created May 27, 2013 01:50
Example Rubymotion menubar app
# -*- 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
@hboon
hboon / RubyMotionViewcontrollerOrientation.rb
Created April 5, 2013 06:03
Implementing mixed-orientation in RubyMotion for iOS
#In Rakefile, set something like app.interface_orientations = [:portrait, :landscape_left, :landscape_right]
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
application.setStatusBarStyle(UIStatusBarStyleBlackOpaque, animated:true)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = NavigationController.alloc.initWithRootViewController(PortraitViewController.alloc.init)
@window.makeKeyAndVisible
true
end
@JoeyButler
JoeyButler / chat.html
Created October 24, 2011 00:14
Simple Chat app
<!DOCTYPE html>
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script>
<script>
$(document).ready(function(){
function debug(str){ $("#debug").append("<p>"+str+"</p>"); };
if(typeof WebSocket === 'undefined') {
alert("Your browser does not support websockets.")
}
@napcs
napcs / README.md
Created May 6, 2011 04:10
Deploying Rails to Linode

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup

@Evangenieur
Evangenieur / Readme.md
Created March 27, 2011 23:30 — forked from grosser/Readme.md
Ruby Server / Node.js Benchmark

Sinatra

ruby 1.9.2 + async_sinatra + thin thin start

ab -n 10000 -c 100 http://localhost:3000/
-> 49ms / request

Node

node server.js