Skip to content

Instantly share code, notes, and snippets.

View szabcsee's full-sized avatar
🏠
Working from home

Szabolcs Bökönyi szabcsee

🏠
Working from home
View GitHub Profile
### Keybase proof
I hereby claim:
* I am szabcsee on github.
* I am szabcsee (https://keybase.io/szabcsee) on keybase.
* I have a public key whose fingerprint is 3091 9CB3 E3DC AF37 9A77 F640 1618 6DDB 2B3D 736A
To claim this, I am signing this object:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div data-closetext="Schließen" class="eb_colorbox_content eb_lightbox_form"><div class="eb_lightbox_title">Weltzeituhr - Einstellungen ändern</div><form action="https://ebase.dlh.de/ebase/home/de/_jcr_content/rightColumn1/worldclockgadget.ebase_userprefs_dialog.htx" method="POST"><div class="eb_worldclock_form_field">
<h4>Städte wählen</h4>
@szabcsee
szabcsee / app.js
Last active August 29, 2015 14:05
Ember data questions
var App = Ember.Application.create({
LOG_TRANSITIONS_INTERNAL: true,
LOG_ACTIVE_GENERATION: true,
LOG_VIEW_LOOKUPS: true,
LOG_RESOLVER: true
});
Ember.run.backburner.DEBUG = true;
Ember.ENV.RAISE_ON_DEPRECATION = true;
Ember.LOG_STACKTRACE_ON_DEPRECATION = true;
@szabcsee
szabcsee / check-apache-user.php
Created March 31, 2014 19:20
How to check apache user on php
<?php echo exec('whoami'); ?>
@szabcsee
szabcsee / rack-flash3-layout.erb
Last active August 29, 2015 13:56
Rack-Flash3 proper implementation on Sinatra
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>This is the sandbox playground of Sinatra</title>
</head>
<body>
<% [:notice, :warning, :error].each do |key| %>
<% if flash.include?(key) %>
<h2 class="alert <%= key %>"><%= flash[key] %></h2>
@szabcsee
szabcsee / aws-s3.rb
Created February 18, 2014 15:41
File upload to AWS S3 with ruby and sinatra
require 'sinatra'
require 'aws/s3'
AWS::S3::Base.establish_connection!(
:access_key_id => 'key_id',
:secret_access_key => 'secret_access_key'
)
get '/upload' do
print 'Ez van a bucketekben:'
@szabcsee
szabcsee / data2csv-data2json-data2arr.rb
Last active December 1, 2020 00:10
Sinatra delivers data as json and deliver data in csv as attachment
require 'sinatra'
require 'json'
require 'csv'
# Serve data as JSON
get '/hi/:name' do
name = params[:name]
content_type :json
{ :message => name }.to_json
end
@szabcsee
szabcsee / wpheader-partial.php
Created March 14, 2013 12:19
Set <og:image> for Facebook in Wordpress blogs. Place it in the header
<?php if (is_single()){
$facebookimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<meta property="og:image" content="<?php echo $facebookimage[0];?>"/>
<?php }; ?>
@szabcsee
szabcsee / google_fish_and_sinatra.rb
Last active October 13, 2015 23:08
GoogleFish Ruby gem usage, how it works with Sinatra
get '/translate' do
doc = open(params[:url]) { |f| Hpricot (f) }
doc.search("//iframe").remove
doc.search("//script").remove
doc.search("//.headline_meta").remove
doc.search("//frameset").remove
article = (doc/".post").inner_html
google = GoogleFish.new('YOUR-API-KEY')
@result = google.translate( params[:language_from], params[:language_to], 'Good night, sleep tight')