Skip to content

Instantly share code, notes, and snippets.

View trekdemo's full-sized avatar

Gergő Sulymosi trekdemo

View GitHub Profile
@trekdemo
trekdemo / shell
Created February 16, 2011 10:56
Diff files selected in the TextMate drawer with Kaleidoscope
sudo ln -s /usr/local/bin/ksdiff /usr/bin/ksdiff
@trekdemo
trekdemo / Livereload Safari 1.6.1 log
Created March 31, 2011 10:31
Livereload bug when connecting to it with Safari ext 1.6.1
LiveReload is waiting for browser to connect.
[[:initialize]]
[[:receive_data,
"GET /websocket HTTP/1.1\r\nUpgrade: WebSocket\r\nConnection: Upgrade\r\nHost: localhost:35729\r\nOrigin: safari-extension://com.mockko.livereload-d963m2vvch\r\nCookie: has_js=1\r\nSec-WebSocket-Key1: 8U O. I4QP8 9p y30{(00 5\r\nSec-WebSocket-Key2: 4 12&52} 0 Q 55 60\r\n\r\n\260\257\017\322\310\357Cv"]]
[[:inbound_headers,
"GET /websocket HTTP/1.1\r\nUpgrade: WebSocket\r\nConnection: Upgrade\r\nHost: localhost:35729\r\nOrigin: safari-extension://com.mockko.livereload-d963m2vvch\r\nCookie: has_js=1\r\nSec-WebSocket-Key1: 8U O. I4QP8 9p y30{(00 5\r\nSec-WebSocket-Key2: 4 12&52} 0 Q 55 60\r\n\r\n\260\257\017\322\310\357Cv"]]
[[:upgrade_headers,
@trekdemo
trekdemo / yes_or_no.rb
Created June 6, 2011 20:20
Yes or no
does = is = { true => 'Yes', false => 'No' }
# Use it
does[10 == 50] # => "No"
is[10 > 5] # => "Yes"
@trekdemo
trekdemo / stay_standalone.js
Created June 23, 2011 07:13 — forked from kylebarrow/example.html
Prevent links in standalone web apps opening Mobile Safari
// Mobile Safari in standalone mode
if(("standalone" in window.navigator) && window.navigator.standalone){
window.addEventListener("load",function() {
var links = document.getElementsByTagName('a'),
i = link.length - 1;
for ( ;i; i--)
{
helper_method :grand_parent, :parent, :resource
def grand_parent
end
def parent
@parent = params ....
end
@trekdemo
trekdemo / min_max.js
Created October 10, 2011 11:13
Min/Max selection in javascript ( ruby style )
// Usage
// [1, 2, 3, 4].max() => 4
// [1, 2, 3, 4].min() => 1
//
// With blocks
// [1, 2, 3, 4].max( function(d){
// return d*-1;
// }); => -1
//
// [1, 2, 3, 4].min( function(d){
@trekdemo
trekdemo / devise.hu.yml
Created October 17, 2011 11:16 — forked from czettnersandor/devise.hu.yml
Hungarian translation for Devise
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
hu:
errors:
messages:
expired: "lejárt, igényelj egy újat"
not_found: "nem található"
already_confirmed: "már meg van erősítve"
not_locked: "nincs zárolva"
not_saved:
@trekdemo
trekdemo / index.html
Created December 11, 2011 09:58
Add application to Page tag
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml">
<body>
<a href="#" onclick=window.open("http://www.facebook.com/dialog/pagetab?
app_id=YOUR_APP_ID&next=YOUR_URL","PageTab","width=500,height=200");>
Dialog</a>
</body>
</html>
@trekdemo
trekdemo / policy.json
Created January 10, 2012 10:05
Restrict user access to a specified bucket on Amazon S3
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource": "arn:aws:s3:::*"
@trekdemo
trekdemo / permission.json
Created January 16, 2012 10:49
Amazon S3: Public read permission for anybody
{
"Version": "2008-10-17",
"Id": "",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},