Skip to content

Instantly share code, notes, and snippets.

@orbanbotond
orbanbotond / Google API Calls
Created August 15, 2014 14:09
Google Api calls
Retrieve token from refresh Google:
curl -v -F refresh_token=1/947yjadmRUOuFcg9EKsIPt_A1z3hklTR1F_wnP7NIbw -F client_id=633713095109-t1d7unbqb8rjc9e88rtngi4fkpietaot.apps.googleusercontent.com -F client_secret=Be9G1-cA7-kCOm8nRAsCCPAB -F grant_type=refresh_token https://accounts.google.com/o/oauth2/token
@orbanbotond
orbanbotond / logger
Created December 29, 2014 12:16
logger and rails logger snippets
<snippet>
<content><![CDATA[logger.${1:debug} "${2:your debug info}"]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>log</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ruby</scope>
</snippet>
<snippet>
<content><![CDATA[Rails.logger.${1:debug} "${2:your debug info}"]]></content>
@orbanbotond
orbanbotond / LeanKit Popular Ruby Book Sort
Created January 6, 2015 14:31
Leankit Popular Book Sort
@orbanbotond
orbanbotond / double_spy_mocks.rb
Created January 22, 2015 14:36
Doubles Spies Mocks
#---
# Excerpted from "Rails 4 Test Prescriptions",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/nrtest2 for more book information.
#---
require 'rails_helper'
@orbanbotond
orbanbotond / Rspec noun-phrase
Created January 23, 2015 12:26
Rspec noun-phrase
be_odd
be_an
be_done
be_an_ufo calls ufo?
an_object_eq_to
an_object_having_attributes
a_string_starting_with
a_string_ending_with
a_string_matching
a_value
@orbanbotond
orbanbotond / erb2slim
Created February 17, 2015 14:36
erb2slim
gem install haml
gem install hpricot
gem install ruby_parser
gem install haml2slim
gem install html2slim
erb2slim -h
@orbanbotond
orbanbotond / chewy usage
Last active August 29, 2015 14:16
chewy usage
[["Cseva", ["csevapcsicse"]], ["Cseva", ["masik", "cseva"]], ["Masik", ["harmadik"]], ["Egyik", ["masik"]]]
SearchIndex.delete!
SearchIndex.reset!
SearchIndex.purge!
res = SearchIndex.filter(term: {account_id: 1}).query( multi_match: { query: 'masik', fields: ['name', 'descriptions']})
res.to_a
a = Subscribem::Account.find 1
r = Recipe.scoped_to(a).first
t = r.tasks.first
@orbanbotond
orbanbotond / junk traff
Created August 10, 2015 10:23
junk traff
p = Project.find 1
p.shared_at = nil
p.create_mode!
p.end_sharing = false
p.save
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
# Build Notes
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/mxcl/homebrew/issues/issue/2510
To build plpython against a specific Python, set PYTHON prior to brewing:
PYTHON=/usr/local/bin/python brew install postgresql
See:
http://www.postgresql.org/docs/9.1/static/install-procedure.html