Skip to content

Instantly share code, notes, and snippets.

View ebrugulec's full-sized avatar
💃

Ebru Gulec ebrugulec

💃
  • Berlin, Germany
View GitHub Profile
class ExampleJob < ActiveJob::Base
rescue_from(ErrorLoadingSite) do
retry_job wait: 5.minutes, queue: :low_priority
end
def perform(*args)
# Perform Job
end
end
class ExampleJob < ActiveJob::Base
# Set the Queue as Default
queue_as :default
def perform(*args)
# Perform Job
end
end
@WebMethod(operationName = "getInstaPic")
public String getInstaPic(@WebParam(name = "username") String username) {
String userImage = "";
String site_url = "http://www.instagram.com/" + username;
try{
Connection.Response insta_response = Jsoup.connect(site_url).timeout(50000).execute();
Document insta_doc = insta_response.parse();
Elements meta_im = insta_doc.select("meta[property=og:image]");
if(!meta_im.isEmpty()){
<?php
ini_set("soap.wsdl_cache_enable",0);
$values=array(
"username" => "glcebru"
);
$wsdl_url = "http://ebru:8080/WebServisOdevi/WebServis?wsdl";
$client = new SoapClient($wsdl_url);
@WebMethod(operationName = "getTwitPic")
public String getTwitPic(@WebParam(name = "username") String username) {
String userImage = "";
String site_url = "http://www.twitter.com/" + username;
try{
Connection.Response twitter_response = Jsoup.connect(site_url).timeout(50000).execute();
Document doc = twitter_response.parse();
Elements img_element = doc.select("img.ProfileAvatar-image");
if(!img_element.isEmpty()){
def index
@shippings = Shipping.active.includes(:zones, :tiers).all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @shippings }
end
end
def index
@shippings = Shipping.active.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @shippings }
end
end
@companies = Company.joins(:persons).where(:persons => { active: true } ).all
@companies.each do |company|
company.name
end
@companies = Company.includes(:persons).where(:persons => { active: true } ).all
@companies.each do |company|
company.person.name
end
> Post.new
=> #<Post id: nil, title: nil, created_at: nil, updated_at: nil, user_id: nil, published: true>