This file contains hidden or 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
// All elements which match this will be syntax highlighted. | |
var selector = 'code'; | |
var keywords = ('var function if else for while break switch case do new ' | |
+'continue delete return this true false throw catch typeof').split(' '); | |
// Syntax definition | |
// The key becomes the class name of the <span> | |
// around the matched block of code. | |
var syntax = { |
This file contains hidden or 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
# This is how you can get a user's location using MacRuby and CoreLocation | |
framework 'CoreLocation' | |
def locationManager(manager, didUpdateToLocation: new_location, fromLocation: old_location) | |
puts "location: #{new_location.description}" | |
exit | |
end | |
loc = CLLocationManager.alloc.init | |
loc.delegate = self |
This file contains hidden or 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
framework 'Foundation' | |
class String | |
def language | |
CFStringTokenizerCopyBestStringLanguage(self, CFRangeMake(0, self.size)) | |
end | |
end | |
puts "Happy new year!".language | |
# => "en" | |
puts "С новым годом!".language |
This file contains hidden or 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
<?php | |
// <!DOCTYPE html> | |
echo $view->doctype('HTML5'); | |
// <meta charset="UTF-8"> | |
echo $view->headMeta()->setCharset('UTF-8'); |
This file contains hidden or 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
<?php | |
$date = new Zend_Date(); | |
$date->setLocale('ru_RU'); | |
$liveDocx = new Zend_Service_LiveDocx_MailMerge(); | |
$liveDocx->setUsername('myUsername') | |
->setPassword('myPassword'); |
This file contains hidden or 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
<?php | |
$textile = Zend_Markup::factory('Textile'); | |
// <strong>жирный текст</strong> и <em>курсивный текс</em> | |
echo $textile->render('*жирный текст* и _курсивный текс_'); |
This file contains hidden or 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
<?php | |
/** | |
* Создаю фид | |
*/ | |
$feed = new Zend_Feed_Writer_Feed; | |
$feed->setTitle('Заголовок блога'); | |
$feed->setLink('http://www.example.com'); | |
$feed->setFeedLink('http://www.example.com/atom', 'atom'); | |
$feed->addAuthor(array( |
This file contains hidden or 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
<?php | |
$manager = new Zend_Cache_Manager; | |
$dbCache = array( | |
'frontend' => array( | |
'name' => 'Core', | |
'options' => array( | |
'lifetime' => 7200, | |
'automatic_serialization' => true |
This file contains hidden or 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 reader = new FileReader(); | |
reader.onload = function(e) { | |
var bin = e.target.result; | |
// bin is the binaryString | |
}; | |
reader.readAsBinaryString(file); |
This file contains hidden or 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
macruby -r snapper.rb -e "Snapper.new.save('http://serenity.su', 'serenity.su.png')" |