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
#
@jeffrafter
jeffrafter / factory_girl attachments for paperclip
Created May 30, 2010 13:26
factory_girl attachments for paperclip
require 'action_controller/test_process'
# Paperclip attachments in factories, made easy based on technicalpickles
Factory.class_eval do
def attach(name, path, content_type = nil)
if content_type
add_attribute name, ActionController::TestUploadedFile.new("#{RAILS_ROOT}/#{path}", content_type)
else
add_attribute name, ActionController::TestUploadedFile.new("#{RAILS_ROOT}/#{path}")
end
# 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;
@mislav
mislav / _notes.md
Created July 21, 2010 18:25
"livereload" server replacement for working with Rails

A replacement for "livereload" gem on OS X

This script is a replacement for livereload server component designed for working with Rails. It watches the filesystem with FS Events (Mac OS X) rather than with EventMachine. This is better for large projects for wich EventMachine fails with "too many open files" exception.

Sass is supported; .sass files can also be stored in "app/styles/" directory. Compass is detected if "config/compass.rb" file exists.

Installation:

Download this script to somewhere in your PATH and make it executable. You can name it something different than "livereload" if you want to try this and the official gem executable in parallel.

@cms
cms / es3-es5-incompatibilities.js
Created October 27, 2010 18:55
List of ES3 Incompatibilities introduced by ES5
/*
* List of ES3 Incompatibilities introduced by ES5.
*
*/
/*
* From Annex E:
*/
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
@jed
jed / LICENSE.txt
Created May 10, 2011 16:04 — forked from 140bytes/LICENSE.txt
write contextual templates
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@madrobby
madrobby / LICENSE.txt
Created May 19, 2011 14:46 — forked from 140bytes/LICENSE.txt
Mock objects
Copyright (c) 2011 Thomas Fuchs, http://mir.aculo.us/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions: