This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deployment: | |
production: | |
branch: master | |
commands: | |
- NEED_MAINTENANCE_MODE=`./script/circleci.sh`; if [ $NEED_MAINTENANCE_MODE -eq 1 ]; then heroku features:disable preboot --app production; else heroku features:enable preboot --app production; fi | |
- NEED_MAINTENANCE_MODE=`./script/circleci.sh`; if [ $NEED_MAINTENANCE_MODE -eq 1 ]; then heroku maintenance:on --app production; fi | |
- NEED_MAINTENANCE_MODE=`./script/circleci.sh`; if [ $NEED_MAINTENANCE_MODE -eq 1 ]; then heroku scale worker=0 --app production; fi | |
- git push -f [email protected]:production.git $CIRCLE_SHA1:refs/heads/master | |
- NEED_MAINTENANCE_MODE=`./script/circleci.sh`; if [ $NEED_MAINTENANCE_MODE -eq 1 ]; then heroku run 'rake db:migrate' --app production; fi | |
- heroku run 'rake db:seed' --app production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var="https://github.com/user/repo/compare/049508ce0e26...286b18317092" | |
echo ${var#*compare/} | |
# 049508ce0e26...286b18317092 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Security | |
public class Keychain { | |
public class func save(str: String?, forKey: String) -> Bool { | |
if str == nil { | |
return false | |
} | |
let dataFromString: NSData = str!.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)! | |
let query = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Model { | |
class func classString() -> String { | |
return NSStringFromClass(self.classFromCoder) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swift Sequence | |
import UIKit | |
var str = "Hello, playground" | |
class Cart<T> { | |
var items: [T] | |
init(items: [T]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deployment: | |
production: | |
branch: master | |
commands: | |
- heroku maintenance:on --app production | |
- heroku scale worker=0 --app production | |
- git push -f [email protected]:production.git $CIRCLE_SHA1:refs/heads/master | |
- heroku run 'rake db:migrate; rake db:seed' --app production | |
- heroku maintenance:off --app production | |
staging: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
box: nafu/[email protected] | |
# Build definition | |
# See the Rails section on the wercker devcenter: | |
# http://devcenter.wercker.com/articles/languages/ruby/settingup-rails4.html | |
# You will want to define your database as follows: | |
services: | |
- wercker/postgresql | |
# See more about services on our devcenter: | |
# http://devcenter.wercker.com/articles/services/ | |
build: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'webrick' | |
class TestContentServlet < WEBrick::HTTPServlet::AbstractServlet | |
def do_GET(req, res) | |
res.body = get_body(req.path) | |
res.content_type = WEBrick::HTTPUtils.mime_type( | |
req.path_info, WEBrick::HTTPUtils::DefaultMimeTypes) | |
end | |
def get_body(path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WORD='XXX:'; FILE=`ack $WORD -l | head -1`; cat $FILE; sed '/'$WORD'/d' $FILE > tmp; mv tmp $FILE; |
NewerOlder