Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
COUNT="3"
HOST="google.com"
PING="/sbin/ping"
while true ;do
$PING -c $COUNT $HOST > /dev/null
if [ "$?" = "68" ];then
networksetup -setairportpower en0 on
@yalab
yalab / .gitignore
Last active January 20, 2016 07:37
.gitignore for cocos2d-x project
*.udf
*.apk
*.o
*.a
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcworkspace/contents.xcworkspacedata
**/*.xcodeproj/*
!**/*.xcodeproj/project.pbxproj
.DS_Store
# config/initializers/puma_worker_killer.rb
module QuietPumaWorkerKillerLog
def log(str)
if !ENV["ENABLE_PUMA_WORKER_KILLER_LOG"] && str.split(/\s/)[0] == "PumaWorkerKiller:"
# Nothing to do
else
super
end
end
end

cocos2d-x でのプロジェクトの作り方

$ cd ~/project/oke-ya 
$ cocos new -l cpp -p witch.oke-ya.com witch
$ cd witch
$ git init
$ curl -O https://gist.githubusercontent.com/yalab/c7f9e5158ef49e260fb9/raw/82126b290f15529cfdc9fecec1d9a500fddfa77e/.gitignore
$ rm -rf cocos2d
$ rm Resources/fonts/*
# config/initializers/active_record_save_scope_names.rb
ActiveSupport.on_load(:active_record) do
module SaveScopeNames
extend ActiveSupport::Concern
module ClassMethods
attr_reader :scope_names
def scope(*args)
@scope_names ||= []
@scope_names << :"#{self.name.downcase}##{args.first}"
super
#!/bin/bash
APP_NAME=$1
if [ -z "$APP_NAME" ];then
echo "Usage: create_cocos app_name"
exit 1
fi
COCOS="cocos2d-x/tools/cocos2d-console/bin/cocos"
COCOS_TEMPLATE="$(pwd)/cocos2d-x/tools/cocos2d-console/plugins/plugin_generate/bin-templates/cpp-template-default/res-portrait"
@yalab
yalab / imap.rb
Last active April 29, 2016 07:28
require 'net/imap'
imap = Net::IMAP.new('imap.gmail.com', 993, true)
imap.login(ENV["GMAIL_USER"], ENV["GMAIL_PASSWORD"])
imap.select("Inbox")
listprefix = "[Imap]/"
listname = "PROCESSED"
unless imap.list(listprefix, listname)
imap.create("#{listprefix}#{listname}")
#!/bin/bash
FROM="山田_太郎"
POSTAL1="5_4_1"
POSTAL2="0_0_4_4"
ADDR1="大阪市_中央区"
ADDR2="伏見町_4-4-9"
TEL1="06"
TEL2="7878"
TEL3="6838"
TO="吉田_篤"
GC.disable
before = `ps -o rss= -p #{Process.pid}`.to_i
require 'bundler/setup'
require 'mini_magick'
OUTPUT = "output.png"
MATERIAL = "material.png"
FONT_PATH = '/Library/Fonts/Osaka.ttf'
BACKGROUND_COLOR = "#000000"
@yalab
yalab / gist:f26d4e17b25628d6db0cbfc02057fe8b
Created June 6, 2016 10:55
upgrade_edge_cocos2d-x.sh
cd cocos2d
git checkout v3
git pull
./download-deps.py