Skip to content

Instantly share code, notes, and snippets.

tell application "SystemUIServer"
set actionSelected to the button returned of (display dialog "What you want to do?" buttons {"Send file", "Receive file"} default button 2)
if actionSelected = "Send file" then
set filepath to POSIX path of (choose file)
display dialog "Please enter IP address of receiver:" default answer ""
set ipAddress to text returned of result
if ipAddress = "" then
repeat
display dialog "IP address cant be blank,Please enter IP address of receiver:" default answer ""
@meetme2meat
meetme2meat / gist:8521107
Created January 20, 2014 14:48
Fix for multiple delete
$('body').on('click','.deleteFacadeButton',function() {
var checkedVal = $('#deleteAssocShareatives').is(':checked');
deleteFacade(facadeIdToDelete, checkedVal);
$('#show-all-facades').trigger('click');
hideModal($('#deleteFacadeModal'));
})
// Deleting a Facade FIXME - remove the inner event outside
$('body').on('click', '.facadeDelete', function(event){
@meetme2meat
meetme2meat / api_strategies.rb
Created January 8, 2014 13:27
WARDEN SETUP
Rails.configuration.middleware.use RailsWarden::Manager do |manager|
manager.default_strategies :api_authentication
## Write a failure app
manager.failure_app = CustomFailureApp #Proc.new { |env| ['200',{'Content-Type' => 'text/html'},['Logout You Idiot']] }
end
Warden::Strategies.add(:api_authentication) do
def valid?
params[:user] and (params[:user][:email] || params[:user][:password])
> - In ruby 1.8.x, what is the functional difference between rb_thread_schedule and rb_thread_select?
rb_thread_schedule() is the guts of the thread scheduler, it traverses
over the linked list of threads (several times) to find the next one
to switch into. The function is long (250 lines) and messy, and covers
all the combinations of thread status (RUNNABLE, TO_KILL, STOPPED,
KILLED) and wait state (FD, SELECT, TIME, JOIN, PID).
If there are no threads doing i/o or waiting on a timeout,
rb_thread_schedule() picks another thread from the list (considering
@meetme2meat
meetme2meat / ruby_spider.rb
Last active October 14, 2015 02:17
Gist To download File from File Directory exposed via Web Server
require "rubygems"
require "net/http"
require "open-uri"
require "fileutils"
## BASE_DIR where the file will be stored
BASE_DIR = ""
def open_url(url)
begin
url = File.join(BASE_PATH,url)
require "rubygems"
require 'RMagick'
include Magick
## Image that you want to resize
img = ImageList.new(File.join(Rails.root,'public',self.logo_image.to_s))
## Resize Parameter
img.resize!(self.logo_width.to_i, self.logo_height.to_i)
## Resize to filed name you want to use
img.write(File.join(Rails.root,'public',self.logo_image.to_s))