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
auto lo | |
iface lo inet loopback | |
auto eth0 | |
iface eth0 inet static | |
address 192.168.1.51 | |
netmask 255.255.255.0 | |
gateway 192.168.1.1 | |
dns-nameservers 8.8.8.8 |
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
// Colors | |
$base_color: #FFE403; | |
$base_hover_color: #FFFF00; | |
$second_color: #272727; | |
$second_hover_color: #555; | |
// Fonts | |
$font_one: 'Open Sans', sans-serif; | |
// Sprites |
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
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700,300&subset=latin,greek); | |
@import "compass"; | |
@import "compass/utilities/sprites/base"; | |
@import "font-awesome"; | |
@import "front/variables"; | |
@import "front/override"; | |
@import "front/general"; | |
@import "front/header"; | |
@import "front/horizontal_menu"; |
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
$.ajax({ | |
url:"http://uncreative.korny.cc:8888/", | |
type: "POST", | |
data: JSON.stringify({ | |
id: encodeURIComponent($('.post_title').text()), | |
title:$('.post_title').text(), | |
text:$('.post_content').text() | |
.replace(/[^"':;/!?.>,<\[\]{}\-=\+\(\)|!@#$%^&*~`\u2019\u201C\u201D\w]/g," ") | |
.replace(/([.,!?])[\s]*([^\s])/g,"$1 $2") | |
.replace(/\s+/g," ") |
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
ActiveSupport::Notifications.subscribe "sql.active_record" do |name, started, finished, unique_id, data| | |
Thread.current["active_record_sql_count"] ||= 0 | |
if data[:name].nil? || data[:name] != "SCHEMA" | |
Thread.current["active_record_sql_count"] = Thread.current["active_record_sql_count"] + 1 | |
end | |
end | |
ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, started, finished, unique_id, data| | |
time = Time.now | |
slow_logfile = File.open(Rails.root.join("log", "slow.log"), 'a') |
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 'rubygems' | |
require 'json' | |
require 'httparty' | |
require 'active_record' | |
require 'pry' | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'mysql2', | |
:database => 'lol', | |
:username => 'yourusername', |
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 'koala' | |
require 'pry' | |
require 'rubygems' | |
require 'selenium-webdriver' | |
require 'active_record' | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'mysql2', | |
:database => 'test', | |
:username => 'whatever', |
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 'koala' | |
require 'rubygems' | |
require 'active_record' | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'mysql2', | |
:database => 'test', | |
:username => 'whatever', | |
:password => 'whatever', | |
:host => 'localhost') |
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 OmniauthCallbacksController < Devise::OmniauthCallbacksController | |
def all | |
#raise request.env["omniauth.auth"].to_yaml | |
omniauth = request.env["omniauth.auth"] | |
provider = User.from_omniauth(omniauth) | |
if provider.persisted? | |
flash.notice = "Successful login" | |
sign_in(provider.user) | |
@after_sign_in_url = after_sign_in_path_for(provider.user) |
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
def self.from_omniauth(auth) | |
unless provider = Provider.where(auth.slice(:provider, :uid)).first # New User | |
provider = Provider.new(provider: auth.provider, uid: auth.uid, oauth_token: auth.credentials.token) | |
user = User.where(email: auth.info.email).first # If user is already a devise user | |
if user.nil? # New user | |
random_password = (0...8).map{(65+rand(26)).chr}.join | |
user = User.create(email: auth.info.email, password: random_password, password_confirmation: random_password, confirmed_at: Time.now) | |
end | |
provider.user = user | |
end |