Skip to content

Instantly share code, notes, and snippets.

View ka8725's full-sized avatar
๐Ÿš€
Building Web and Mobile apps

Andrei Kaleshka ka8725

๐Ÿš€
Building Web and Mobile apps
View GitHub Profile
def armstrong_number(num)
s_num = num.to_s
len = s_num.length
sc = s_num.split(//).inject(0) {|sum, i| sum + i.to_i * len} # inject ะบะฐะบ ั‚ั‹ ัƒะถะต ะฟะพะฝัะป ะฟั€ะพั…ะพะดะธั‚ัั ะฟะพ ะฒัะตะผัƒ
# ะผะฐััะธะฒัƒ ะธ ะตั‰ะต ะฟะปัŽั ะบ ั‚ะพะผัƒ ะถะต ัะพั…ั€ะฐะฝัะตั‚ ััƒะผะผัƒ.
# ะกัƒะผะผัƒ ั‚ั‹ ัะพัั‚ะฐะฒะปัะตัˆัŒ ัะฐะผ. 0 ะทะดะตััŒ ะฟะตั€ะฒะพะฝะฐั‡ะฐะปัŒะฝะพะต ัะพัั‚ะพัะฝะธะต ััƒะผะผั‹
puts (num == sc ? "BINGO! #{s_num} - ัะฒะปัะตั‚ัั ั‡ะธัะปะพะผ ะั€ะผัั‚ั€ะพะฝะณะฐ" : "#{s_num} - ะฝะต ัะฒะปัะตั‚ัั ั‡ะธัะปะพะผ ะั€ะผัั‚ั€ะพะฝะณะฐ")
end
# encoding: utf-8
require 'yaml'
module Proxy
OVERRIDEN_METHODS = %w(get post put delete).freeze
APP_CONFIG = YAML.load(File.open File.join(File.dirname(__FILE__), '../config/application.yml'))
def self.included(base)
base.class_eval do
OVERRIDEN_METHODS.each do |method|
<nav>
<ul>
<li>
<a href="/">Home</a>
</li>
<li>
<a href="">RubyGardens</a>
<ul class="sec">
<li class="fst"><span></span></li>
<li><span><b>RubyGardens</b></span></li>
root@saygo:~# aptitude install ruby1.9
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
The following NEW packages will be installed:
libruby1.9{a} ruby1.9
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
$.fn.submitWithAjax = function(params) {
var options = {
type : this.attr('method') || 'POST',
url : this.attr("action"),
data : this.serialize(),
callbacks : {},
target : '#temp',
freezing : this,
dataType : 'script',
autoActivate : true
root@saygo:/home/ubuntu# update-rc.d nginx defaults
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
update-rc.d: using dependency based boot sequencing
62] pry(main)> a = Startup.solr_search{fulltext 'test'}.results
Startup Load (0.2ms) SELECT "startups".* FROM "startups" WHERE "startups"."id" IN (1)
=> [#<Startup id: 1, name: "test", url: "", digital_media_vertical: nil, differentiator_factor: "", tracking_platform: "", ad_units: "", full_description: "", existing_clients: "", user_id: 1, created_at: "2012-01-11 12:38:51", updated_at: "2012-01-11 12:38:51", views_count: nil, approved: nil>]
[63] pry(main)> a = Startup.solr_search{fulltext 't'}.results
=> []
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libcouchbase configure 0.3.0_80_geb7c70c, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/libcouchbase/80 --disable-couchbasemock --with-memcached-headers-url=https://raw.github.com/membase/memcached/engine/include/memcached
## --------- ##
## Platform. ##
Dependencies Resolved
===================================================================================================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================================================================================================
Installing:
libxml2-devel i386 2.6.26-2.1.2.8.el5_5.1 base 2.1 M
libxml2-devel x86_64 2.6.26-2.1.2.8.el5_5.1