Skip to content

Instantly share code, notes, and snippets.

View almaron's full-sized avatar

Ilya Levin almaron

View GitHub Profile
Bootstrapping Chef...
DEBUG: Initial command uname -s
DEBUG: Initial command sudo -V
DEBUG: Running processed command sudo -V
DEBUG: sudo -V stdout: Sudo версия 1.8.6p3
Параметры настройки: --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --prefix=/usr --sbindir=/usr/sbin --libdir=/usr/lib64 --docdir=/usr/share/doc/sudo-1.8.6p3 --with-logging=syslog --with-logfac=authpriv --with-pam --with-pam-login --with-editor=/bin/vi --with-env-editor --with-ignore-dot --with-tty-tickets --with-ldap --with-ldap-conf-file=/etc/sudo-ldap.conf --with-selinux --with-passprompt=[sudo] password for %p: --with-linux-audit --with-sssd
DEBUG: sudo -V stdout: Sudoers policy plugin version 1.8
Bootstrapping Chef...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15934 100 15934 0 0 37877 0 --:--:-- --:--:-- --:--:-- 95413
Downloading Chef 11.12.0 for el...
downloading https://www.opscode.com/chef/metadata?v=11.12.0&prerelease=false&nightlies=false&p=el&pv=6&m=x86_64
to file /tmp/install.sh.11766/metadata.txt
trying curl...
url https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-11.12.0-1.el6.x86_64.rpm
md5 3e4fadc93e3080ec0b2ed811f36cb8bc
class GuestPost < ActiveRecord::Base
require 'rails_autolink'
validates_presence_of :head, :content, :user
def apply_answer(answer=nil)
if answer.present?
@answer = auto_link(answer)
end
@app.factory 'ArrayService', ->
{
findInArrayBy: (array, index, value) ->
flag = false
angular.forEach array, (item, key)->
if item[index] == value
flag = true
flag
}
@almaron
almaron / gist:d7da253e32115851f33f
Last active August 29, 2015 14:02
Jbuilder setting values in array loop
# Can I do something like this?
%w(text_field, another_text_field, some_more_text).each do |field|
json.field simple_format(@item.send(field.to_sym)
end
# Instead of this
json.text_field simple_format(@item.text_field)
json.another_text_field simple_format(@item.another_text_field)
json.some_more_text simple_format(@item.some_more_text)
@app.controller 'NewsCtrl', ["$scope", "$location", "News", ($scope, $location, News) ->
$scope.loadSomeNews = (number) ->
$scope.news = News.query {limit: number}
$scope.pagination = { }
$scope.initNews = (page = 1) ->
$scope.pagination.cur = page
$scope.getTotal()
@app.factory "News", ["$resource", ($resource) ->
$resource("/news/:id.json",{id: '@id'}, {update: {method: "PUT"}, get_total:{method:"GET", params:{get_total:true}}})
]
@almaron
almaron / gist:5739bfb6acc9a05b79a6
Created June 10, 2014 11:04
Can anyone help me simplify this?
#forum.rb
def get_all_posts
forums = self.subtree_ids
topics = Topic.where(forum_id: forums).collect(&:id)
posts = Post.where(topic_id: topics)
end
# Forum has_many :topics and has_ancestry
# Topic has_many :posts
<!--
If I have a $scope.links array how do I make this in angular?
-->
<a href="/links/linkl_head">link1_link</a>, <a href="/links/link2_head">link2_link</a>, <a href="/links/link3_head">link3_link</a>, <a href="/links/link4_head">link4_link</a>, <a href="/links/link5_head">link5_link</a>
[
{
"id": 1,
"name": "Игровой раздел",
"hidden": 0,
"technical": 0,
"is_category": 1,
"image": null,
"description": null,
"isCategory": true,