This file contains hidden or 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
<%= stylesheet_link_tag "pikaday", :media => "all" %> | |
<%= form_for(@news) do |f| %> | |
<!-- Generate HTML --> | |
<%= form_datetime_selector_helper(:obj => f, | |
:field_name => :publish_date, | |
:label_name => 'Publish Date', | |
:date => @news.publish_date).html_safe %> | |
<% end %> |
This file contains hidden or 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 'dragonfly' | |
app = Dragonfly[:images] | |
mconfig = Mongoid.load!("config/mongoid.yml", Rails.env) | |
app.datastore = Dragonfly::DataStorage::MongoDataStore.new | |
app.datastore.configure do |c| | |
cfg = mconfig['sessions']['default'] |
This file contains hidden or 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
#!/bin/sh | |
VBoxManage list runningvms | awk '{split($0, a, " {"); gsub(/\"/,"", a[1]); print a[1]}' | xargs -I {} -t VBoxManage controlvm {} savestate |
This file contains hidden or 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
namespace :facebook do | |
desc "Check if users have updated their Facebook verification status" | |
task :update_user_verifiation_status => :environment do | |
require 'omniauth' | |
# get all users who are not currently verified | |
@users = User.joins(:authentications, :profile).where(:"authentications.provider" => "facebook", :"user_profiles.facebook_verified" => 0).select("users.id AS id, authentications.uid, authentications.access_token, user_profiles.facebook_verified") | |
@users.each do |user| | |
FB = OmniAuth::Strategies::Facebook.new("nothing") |
This file contains hidden or 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
#!/bin/sh | |
vlc="/Applications/VLC.app/Contents/MacOS/VLC" | |
ext="mp3" | |
dest="/Users/ryan/Desktop/mp3/" | |
for ARG in "$@"; do | |
NEWFILE="$dest$(basename "$ARG").$ext" | |
$vlc -I dummy -vvv "$ARG" --sout "#transcode{acodec=mp3,ab=128,channels=2,samplerate=44100}:std{mux=raw,dst=\"$NEWFILE\",access=file}" vlc://quit | |
done |
This file contains hidden or 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
FB = OmniAuth::Strategies::Facebook.new("nothing") | |
client = ::OAuth2::Client.new("nothing", "nothing", FB.client_options) | |
cached_token = "app_id_part|session_id_part|token_part" # or maybe you sent it from the iPhone | |
access_token = ::OAuth2::AccessToken.new(client, cached_token) | |
FB.instance_variable_set("@access_token", access_token) | |
FB.user_info |
This file contains hidden or 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
# controllers/shared/abstract_email_controller.rb | |
module Shared | |
class AbstractEmailController < AbstractController::Base | |
include AbstractController::Rendering | |
include AbstractController::Layouts | |
include AbstractController::Helpers | |
include AbstractController::Translation | |
include AbstractController::AssetPaths |
This file contains hidden or 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
The purpose of all this is to see if sphinx, thinking sphinx and thinking sphinx delayed delta are all working properly. | |
I created a test controller on a separate monit subdomain that simply generates and posts a test value and then uses curl to retrieve it. If the two values match, then sphinx is working properly with delayed delta. | |
This example assumes a Linux installation. | |
The file 'delayed_delta.sh' spawns the `rake ts:dd` process in the background, saving its PID to tmp/pids in your Rails project. You can start and stop it by running '/etc/init.d/delayed_delta.sh start' and '/etc/init.d/delayed_delta.sh stop'. You will use these in your monitoring to, see the monitrc snippet. | |
In a crontab, every X seconds or minutes, run 'ar_sphinx_mon.sh' to see if records are properly being inserted and indexed. If they aren't, then kill all Thinking Sphinx processes and monit should restart them. |
This file contains hidden or 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
<div id="user_nav"> | |
<% if user_signed_in? %> | |
<img src="<%= user_avatar %>" id="main_avatar"> Signed in as <%= current_user.email %>.<br /> | |
Not you? | |
<% if session[:fb_token].nil? %> | |
<%= link_to "Sign out", destroy_user_session_path %> | |
<% else %> | |
<%= link_to "Sign out", facebook_logout_path %> | |
<% end %> |
This file contains hidden or 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
/* | |
* Wrote this for the Design Board at equilter.com almost 10 years ago. | |
* Can't believe it still works and it's still in use! | |
* Should work for any DHTML browser known to man. | |
* | |
* Not so fond memories of getting it to work on MSIE 4 for Mac. | |
* | |
* To experience: | |
* 1. Add items to shopping cart | |
* 2. Click the Design Board at the top right. |
NewerOlder