Skip to content

Instantly share code, notes, and snippets.

View RStankov's full-sized avatar
🤖
👨‍💻

Radoslav Stankov RStankov

🤖
👨‍💻
View GitHub Profile
# Интеграция с ePay
#
#
# 1. Сложи следното в epay.rb някъде из lib/ или там, откъдето предпочитаният ти
# framework си зарежда допълнителен код. По default заявките се генерират
# в test mode към demo сървъра на ePay. Когато си готов, слагаш това в
# някой initializer.
#
# Epay.mode = :production
#
# Using Sprockets in Rails 3
MyApp::Application.routes.draw do
match 'application.js', :to => Sprockets::Server.new(YAML.load_file(Rails.root.join("config/sprockets/application.yml")))
end
Object.extend(Date.prototype, {
strftime: function(format) {
var day = this.getDay(), month = this.getMonth();
var hours = this.getHours(), minutes = this.getMinutes();
return format.gsub(/\%([aAbBcdDHiImMpSwyY])/, function(part) {
switch(part[1]) {
case 'a': return $w("Sun Mon Tue Wed Thu Fri Sat")[day]; break;
case 'A': return $w("Sunday Monday Tuesday Wednesday Thursday Friday Saturday")[day]; break;
case 'b': return $w("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")[month]; break;
brew search postgres
brew tap homebrew/versions
brew install postgresql8
@mikegehard
mikegehard / 0_README.md
Created May 5, 2011 02:39 — forked from netzpirat/0_README.md
Continuous CoffeeScript testing with Guard and Jasmine

Continuous CoffeeScript testing with Guard and Jasmine

This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo

  • Install Gems with Bundler with bundle install
  • Define your guards with mate Guardfile
  • Initialize Jasmine with bundle exec jasmine init
  • Configure Jasmine with mate spec/support/yasmine.ym
  • Start Guard with bundle exec guard
@kneath
kneath / twitter_timeline.coffee
Created May 30, 2011 07:14
Example file for my History API experiment
# JSONP callback for tweets fetched later than current (max_id)
window.twitterTimelineLaterCallback = (data) ->
window.app.twitterTimeline.receivedData(data, false)
# JSONP callback for tweets fetched earlier than current (since_id)
window.twitterTimelineEarlierCallback = (data) ->
window.app.twitterTimeline.receivedData(data, true)
class window.TwitterTimeline
# Distance from the bottom that we ask for more tweets, distance from the
@a2800276
a2800276 / nodecamp.eu-talks-2011.md
Created June 14, 2011 04:37 — forked from fhemberger/nodecamp.eu-talks-2011.md
A collection of talks and presentations held at nodecamp.eu 2011
@RStankov
RStankov / gist:1234658
Created September 22, 2011 12:36
Dropbox Git repo
~/project $ git init
~/project $ git add .
~/project $ git commit -m "first commit"
~/project $ cd ~/Dropbox/code/git
~/Dropbox/git $ mkdir project.git
~/Dropbox/git $ cd project.git
~/Dropbox/git $ git init --bare
~/Dropbox/git $ cd ~/project
@dandean
dandean / backbone.model.es5properties.js
Created October 17, 2011 06:30
Monkey patch `Backbone.Model.extend()` with ES5 getters/setters for each attribute defined in the defaults.
/**
* Monkey patch `Backbone.Model.extend()` with ES5 getters/setters for each
* attribute defined in the defaults. Gives you the added bonus of being
* to pass your backbone models directly to your Mustache.js views.
*
* Example:
*
* var User = Backbone.Model.extend({
* defaults: {
* username: undefined,
@skanev
skanev / debug.rb
Created November 3, 2011 14:17
Debugging the performance of a Rails controller action
require 'rails/console/app'
ActiveSupport::Notifications.subscribe /^sql\./ do |*args|
puts caller.grep(%r[/garmz/]) { |line| " #{line.gsub(/.*?\/garmz\//, '')}" }.take(3) * "\n"
end
ActiveRecord::Base.logger = Logger.new(STDOUT)
app.get '/newsfeed'
ActiveRecord::Base.logger = Logger.new(nil)