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
$(document).ready -> | |
$('form').submit -> | |
$(this).find('.ajax-loader').show() | |
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
params = { | |
'oauth_blah' => 'value' | |
} | |
host = "https://api.example.com" | |
uri = URI.parse host | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true | |
request = Net::HTTP::Get.new('/v1/resource') |
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
# A Liquid tag for Jekyll sites that allows embedding tweets using Twitter's | |
# oEmbed API, and showing the tweet as a blockquote for non-JavaScript enabled | |
# browsers and readers. | |
# | |
# Updated: fixed to use SSL for Twitter oEmbed API endpoint. | |
# | |
# Author: Scott W. Bradley / https://github.com/rob-murray/ | |
# Source URL: https://github.com/scottwb/jekyll-tweet-tag | |
# New source URL: https://gist.github.com/rob-murray/ee56870e9daf4f2eb52c | |
# |
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
# == Schema Information | |
# | |
# Table name: blocks | |
# | |
# id :integer not null, primary key | |
# name :string(255) | |
# content :text | |
# type :string(255) | |
# created_at :datetime | |
# updated_at :datetime |
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
// Install from Homebrew | |
$ brew install memcached | |
// Copy launchctl plist | |
$ cp /usr/local/Cellar/memcached/{version}/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents/ | |
// Launch | |
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist | |
// Un-launch |
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
$(document).ready -> | |
return unless $("#form_elem_id").length | |
$("#form_elem_id").submit (e) -> | |
e.preventDefault() | |
$form = $(this) | |
errors = [] | |
$content_el = $form.find("#something") | |
$errors_el = $('#form_elem_id-errors') | |
$errors_el.empty() |
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 'csv' | |
require 'awesome_print' | |
CSV.foreach('file.csv', :row_sep => :auto) do |row| | |
Kernel.ap "Row>>>>>>>>>>>>>>>>>>>" | |
Kernel.ap row | |
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
## | |
# This override is required and acts as a proxy to Devise::Mailer but calling | |
# delay on sending mail to send Devise mail async. | |
# | |
class AsyncDeviseMailer < Devise::Mailer | |
def self.confirmation_instructions(record, token, opts = {}) | |
new(:confirmation_instructions, record, token, opts) | |
end | |
def self.reset_password_instructions(record, token, opts = {}) |
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
module ApiWrapper | |
# module to handle public api to wrapper | |
class << self | |
def from_config(config = 'config') # set up config from Initializer/Config as per req. | |
Connection.new(config) | |
end | |
def with_errors | |
connector = ErrorRaisingConnector.new(from_config) | |
return connector unless block_given? |
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 NullObject | |
def method_missing(*_args, &_block) | |
self | |
end | |
def respond_to?(_method_name, include_private = false) | |
true | |
end | |
end |