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
<?php | |
$date = new Zend_Date(); | |
$date->setLocale('ru_RU'); | |
$liveDocx = new Zend_Service_LiveDocx_MailMerge(); | |
$liveDocx->setUsername('myUsername') | |
->setPassword('myPassword'); |
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 reader = new FileReader(); | |
reader.onload = function(e) { | |
var bin = e.target.result; | |
// bin is the binaryString | |
}; | |
reader.readAsBinaryString(file); |
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
<?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 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 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 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 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 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
// Если localStorage доступен, используем его | |
if (('localStorage' in window) && window.localStorage !== null) { | |
localStorage.taglist = '["#html5","#css3","#simonenko"]'; | |
} else { | |
// если старый браузер, используем Cookie. | |
var date = new Date(); | |
date.setTime(date.getTime() + (365*24*60*60*1000)); | |
document.cookie = 'taglist=["#html5","#css3","#simonenko"]; expires=' + date.toGMTString() + '; 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
/** | |
* Add this script to the end of your document that use <input autofocus type="text" /> | |
* or <input type="text" placeholder="username" /> and it'll plug support for browser | |
* without these attributes | |
* Minified version at the bottom | |
*/ | |
(function () { | |
function each(list, fn) { | |
var l = list.length; |
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
# Asynchronous DSL for CoffeeScript | |
serial = (f) -> | |
next = -> arr.shift().apply(null, arguments) if arr.length | |
arr = (v for k, v of f(next)) | |
next() | |
null | |
parallel = (f, after = ->) -> | |
res = {}; arrc = 0 |