This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/https" | |
require "uri" | |
uri = URI.parse("https://secure.com/") | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
request = Net::HTTP::Get.new(uri.request_uri) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Small serialize form snippet supporting one level nested attributes. | |
*/ | |
$.fn.serializeObject = function() { | |
var o = {}; | |
var a = this.serializeArray(); | |
var pattern = /\[[\w\d\(\)_]+\]/; | |
$.each(a, function() { | |
var key = this.name; | |
var name = key.replace(/^\w+\[/, '').replace(/\]/, ''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(global) { | |
global.DateTime = DateTime = {}; | |
DateTime.instance = (function() { | |
return { | |
getTime: function(date, gmt_offset) { | |
var date = DateTime.instance.getDate(date, gmt_offset); | |
return date.getHours() + ":" + date.getMinutes(); | |
}, | |
getDate: function(date, gmt_offset) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.oivoodoo = window.oivoodoo || {}; | |
window.oivoodoo.tower = window.oivoodoo.tower || {}; | |
window.oivoodoo.tower.utils = window.oivoodoo.tower.utils || {}; | |
var namespace = window.oivoodoo.tower; | |
namespace.Statuses = { | |
START: 0, | |
STOP: 1, | |
PAUSE: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/http' | |
require 'uri' | |
require 'json' | |
fork do | |
loop do | |
response = Net::HTTP.get_response(URI.parse('http://search.twitter.com/search.json?q=eng_trainer&rpp=1')) | |
json = JSON.parse response.body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe AnalyticsController do | |
#integrate_views | |
before do | |
stub_isar_controllers | |
@account = Account.first | |
@user = User.first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Script for learning english by twitter eng_trainer bot. | |
require 'rubygems' | |
require 'net/http' | |
require 'uri' | |
require 'json' | |
fork do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls -1 | wc -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to test application helpers via terminal. | |
# For example you are using devise. | |
# Type in terminal the next following lines. | |
class << self | |
def current_user | |
User.find_by_name("your username") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GlobalSettingsController < AdminController | |
include Umaami::Controllers::WithoutAccountRelation | |
before_filter :load_global_settings | |
add_catch_exceptions :global_settings, :only => :update | |
def edit | |
end |