This was tested using Ruby 2.0.0 and Rails 4.0.0.rc1.
-
Set the install directory for Bower components:
// .bowerrc {
"directory": "app/assets/components"
| Book.all.each do |book| | |
| next if !book.pages.any? {|p| p.questions.count > 0} | |
| puts "============ #{book.name} ===============" | |
| book.pages.each do |page| | |
| next if page.questions.count == 0 | |
| puts " Page##{page.page_number}" | |
| page.questions.each do |question| | |
| puts " * Question: #{question.content}" | |
| question.question_options.each do |option| | |
| puts " - #{option.content} #{"√" if option.is_correct_answer}" |
| #!/bin/sh | |
| # Optware pre-installation script, Leon Kos 2006, 2008 | |
| # added -verbose_wget to some lines, MrAlvin 2009 | |
| REPOSITORY=http://ipkg.nslu2-linux.org/feeds/optware/ddwrt/cross/stable | |
| TMP=/tmp | |
| PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin | |
| unset LD_PRELOAD | |
| unset LD_LIBRARY_PATH |
| # One thing I don't know is how to pass @var to template. | |
| def to_html | |
| request = ActionDispatch::Request.new Hash.new | |
| # I am using Gon also. | |
| Gon.clear | |
| Gon::Request.instance_variable_set(:@request_id, request.object_id) | |
| Gon::Request.env = {} | |
| # Assign gon variables | |
| Gon.some_variables = self.some_variables |
| codesign -f -v -s "Mac Developer: lixing he (6EAVUH8752)" ./Sparkle.framework/Versions/A/Resources/relaunch |
| require "rubygems" | |
| require "rspec" | |
| class String | |
| def syllable | |
| # bl|qu|ng|ch|rt| | |
| consonants = "bcdfghjklmnpqrstvwxzh" | |
| vowels = "aeiouy" | |
| word = self.downcase | |
| parts = word.split(/(?=ly)/) |
| #!/usr/bin/perl -w | |
| # Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions | |
| # are met: | |
| # | |
| # 1. Redistributions of source code must retain the above copyright | |
| # notice, this list of conditions and the following disclaimer. |
| curl --data-binary @sound.spx --header 'Content-type: audio/x-speex-with-header-byte; rate=16000' 'https://www.google.com/speech-api/v1/recognize?client=chromium&lang=en-US&maxresults=2' |
| // Get a temp file path | |
| [NSTemporaryDirectory() stringByAppendingPathComponent:@"myapptempdirectory.jpg"]); | |
| // To get the filename from the url | |
| [@"http://stackoverflow.com/questions/1098957/objective-c-extract-filename-from-path-string.jpg" lastPathComponent]; |
| "%s %s" % ["a", "b"] => "a b" |