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
require 'rubygems' | |
require 'hpricot' | |
require 'active_support' | |
class Array | |
def sum | |
inject(0) { |a,b| a + b } | |
end | |
end |
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
// DEPRECATED | |
// see https://github.com/livereload/livereload-js/blob/master/dist/livereload.js for an up-to-date version | |
(function() { | |
var __protocol = {}, __connector = {}, __timer = {}, __options = {}, __reloader = {}, __livereload = {}, __startup = {}; | |
// protocol | |
(function() { | |
var PROTOCOL_6, PROTOCOL_7, Parser, ProtocolError; | |
var __indexOf = Array.prototype.indexOf || function(item) { |
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
{Во входном файле wicked.in записаны несколько натуральных | |
числе, меньших 10001. В выходной файл wicked.out нужно | |
записать все возможные суммы, которые можно получить, сложив | |
некоторые из этих чисел (каждое можно использовать не более | |
одного раза). | |
Пример входного файла: 2 3 4 | |
Пример выходного файла: 2 3 4 5 6 7 9 | |
Во входном файле повторяющиеся числа допускаются, в выходном, |
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
{Во входном файле wicked.in записаны несколько натуральных | |
числе, меньших 10001. В выходной файл wicked.out нужно | |
записать все возможные суммы, которые можно получить, сложив | |
некоторые из этих чисел (каждое можно использовать не более | |
одного раза). | |
Пример входного файла: 2 3 4 | |
Пример выходного файла: 2 3 4 5 6 7 9 | |
Во входном файле повторяющиеся числа допускаются, в выходном, |
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
CLEAR="$(echo -e "\e[0m")" | |
BOLD="$(echo -e "\e[1m")" | |
RED="$(echo -e "\e[31m")" | |
GREEN="$(echo -e "\e[32m")" | |
CYAN="$(echo -e "\e[36m")" |
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
// Exports a CSV list of Drupal fields. | |
// Run from any Drupal admin page, from JavaScript console in Safari or Chrome. | |
// Public domain. | |
function get_content_types(root){ | |
var r = []; | |
$('table.sticky-table tr', root).each(function() { | |
var label = $(this).find('td:nth-child(1)').text().replace(/^\s+|\s+$/, ''); | |
var name = $(this).find('td:nth-child(2)').text().replace(/^\s+|\s+$/, ''); | |
if (name != '') { |
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
require 'rake/clean' | |
HAML = FileList['**/*.haml'] | |
LESS = FileList['**/*.less'] | |
COFFEE = FileList['**/*.coffee'] | |
HTML = HAML.ext('html') | |
CSS = LESS.ext('css') | |
JS = COFFEE.ext('js') |
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
#! /usr/bin/env ruby | |
# | |
# Preminifier renames all JavaScript identifiers in your code into short names like aQ, | |
# helping you achieve better compression and better obfuscation. | |
# | |
# Preminifier is designed to be run before a respectable minifier like Closure Compiler | |
# in SIMPLE_OPTIMIZATIONS mode. (Of course, Preminifier is useless if you can run Closure | |
# Compiler in ADVANCED_OPTIMIZATIONS mode, but since that mode is incompatible with jQuery | |
# and generally problematic, you can't always do it.) | |
# |
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
// call when zoom level or page size changes (i.e. after zooming or after rotation) | |
- (void)updateContentInsetForPageScrollView:(UIScrollView *)pageScrollView { | |
UIImageView *imageView = (UIImageView *) [pageScrollView viewWithTag:TAG_IMAGE_VIEW]; | |
CGFloat zoomScale = pageScrollView.zoomScale; | |
CGSize imageSize = imageView.bounds.size; | |
CGSize zoomedImageSize = CGSizeMake(imageSize.width * zoomScale, imageSize.height * zoomScale); | |
CGSize pageSize = pageScrollView.bounds.size; | |
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
updateSize: (comp) -> | |
return unless comp.isInDocument | |
computeSize comp >- (size) | |
$(comp.node).css { width: size.w; height: size.h |