Skip to content

Instantly share code, notes, and snippets.

View kattrali's full-sized avatar

Delisa kattrali

View GitHub Profile
@willrax
willrax / my_scene.rb
Last active August 29, 2015 14:01
Parallax scrolling with Sprite Kit and RubyMotion
# Video of it in action: http://cl.ly/VSIF
class MyScene < SKScene
def scroll_action(x, duration)
width = (x * 2)
move = SKAction.moveByX(-width, y: 0, duration: duration * width)
reset = SKAction.moveByX(width, y: 0, duration: 0)
SKAction.repeatActionForever(SKAction.sequence([move, reset]))
end
export PS1="\n ࿐࿓ \[\033[4;36m\]\u\[\033[m\] \[\033[2m\]\w\[\033[m\] \[\033[31m\]$(ruby -e 'print RUBY_VERSION')\[\033[m\] $(ruby -e "t=Time.now.hour-12;h=t<0?8+t/6*4:3-t/4;f=h==0?'5;':'';puts\"\033[#{f}31m#{'♥'*h+'♡'*(4-h)}\033[m\"")\[\033[m\]\n༼つ◕_◕༽つ "
@luisobo
luisobo / unused_assets
Created May 26, 2014 19:34
Detect unused assets
#!/bin/bash
all_assets=`find $1 -type f | uniq | grep -v @2x`
for asset in $all_assets; do
name=`basename $asset | cut -d . -f 1`
count=`git grep $name | grep -v project.pbxproj: | wc -l`
echo -e "$count\t$asset"
done
// 1. Containing app - Store token url in the group user defaults.
DBAccount *account = [[DBAccountManager sharedManager] handleOpenURL:url];
if (account) {
NSUserDefaults *groupDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.example.app"];
[groupDefaults setObject:url.absoluteString forKey:@"dropbox.token.url"];
[groupDefaults synchronize];
}
// 2. An Extension - Retrieve the token url from group user defaults, then give it to -[DBAccountManager handleOpenURL:] after setting "nonce".
NSUserDefaults *groupDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.example.app"];
#!/usr/bin/env ruby
STDIN.read.split("\n").each{ |line| puts line if (line =~ /CONFLICT/) }
@baroquebobcat
baroquebobcat / mirah_repl.rb
Created May 1, 2012 03:53
Mirah REPL -- hacked together
#
# Mirah REPL -- hacked to bits
#
# assuming your ruby is jruby,
# $ gem install mirah
# $ ruby -rubygems repl.rb
# m> class Foo
# m> def bar
# m> 12
# m> end
@smellman
smellman / patch_for_config_mk_to_icu.diff
Created November 20, 2011 23:48
LuakitをMacOSXでビルドするためのパッチ
diff --git config.mk config.mk
index 8b453ec..d69b687 100644
--- config.mk
+++ config.mk
@@ -46,7 +46,7 @@ have lua >= 5.1 installed)
endif
# Packages required to build luakit
-PKGS := gtk+-2.0 gthread-2.0 webkit-1.0 javascriptcoregtk-1.0 sqlite3 $(LUA_PKG_NAME)
+PKGS := icu-i18n gtk+-2.0 gthread-2.0 webkit-1.0 javascriptcoregtk-1.0 sqlite3 $(LUA_PKG_NAME)
@kylef
kylef / PKGBUILD
Created July 5, 2011 17:41
lxc package for arch linux
pkgname=lxc
pkgver=0.7.4.2
pkgrel=1
pkgdesc="Linux Containers"
arch=('i686' 'x86_64')
url="http://lxc.sourceforge.net/"
depends=('bash' 'perl')
license=('LGPL')
source=("http://lxc.sourceforge.net/download/lxc/$pkgname-$pkgver.tar.gz" lxc.rcd lxc.confd)
md5sums=('36fcb0f6a39d2f55130421f342f24ef3' '520594461912e084c220ca37eb97afd2' 'efb0c46839136842e9d3617924a9b5b5')
@kylef
kylef / Django HTCPCP Middleware.py
Last active November 25, 2015 01:09
A HTCPCP Implementation for Django
from random import randint
from django.http import HttpResponse
class HTCPCPMiddleware(object):
"""
This middleware allows a your django project to act as a HTCPCP (Hyper
Text Coffee Pot Control Protocol) server. If the user requests to BREW
a coffee, and it is not on the list. Then it will get a `406 Not
Acceptable`, and randomly it will respond with `418 I'm a teapot`.