Skip to content

Instantly share code, notes, and snippets.

View attilagyorffy's full-sized avatar
🦜
A UDP packet bar walks a into...

Attila Györffy attilagyorffy

🦜
A UDP packet bar walks a into...
View GitHub Profile
@attilagyorffy
attilagyorffy / import_procuction.sh
Created August 9, 2017 16:06
Import a PostgreSQL production database locally via a pipe
ssh -C myproductionhost.com "sudo -u postgresuser PASSWORD="password" pg_dump production_database_name" | psql local_database_name
@attilagyorffy
attilagyorffy / application_helper.rb
Created June 11, 2017 14:31
Responsive Images in Rails applications
module ApplicationHelper
def responsive_image_tag(image, options = {})
content_tag(:picture) do
concat content_tag(:source, nil, media: '(max-width: 768px)', srcset: image.url(:thumbnail_mobile))
concat content_tag(:source, nil, media: '(max-width: 960px)', srcset: image.url(:thumbnail_tablet))
concat image_tag(image.url(:thumbnail_desktop), options)
end
end
end
@attilagyorffy
attilagyorffy / .gitconfig
Created December 12, 2016 18:57
Git URL shortcuts to github and heroku
# Allow cloning repositories using shortcuts.
# For example:
# git clone gh:attilagyorffy/foo
[url "git@github.com:"]
insteadOf = gh://
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
[url "git://github.com/"]
insteadOf = "github:"
@attilagyorffy
attilagyorffy / gist:9a80aadd7250d6c967ae9e08b5d18400
Created December 11, 2016 19:23 — forked from brandonb927/gist:4149074
Javascript: Async Gist loading
/**
* Shamelessly stolen from http://blog.jeansebtr.com/post/36590722386/async-loading-of-githubs-gists-without-jquery-31-loc
*
* Use like this: <gist data-username="brandonb927" data-id="4138162" data-file="gists2.js"><a href="https://gist.github.com/brandonb927/4138162#file_gists2.js">Gist</a></gist>
* UPDATED 02/06/2013: Github implemented Namespaced Gists a few hours ago, which means gist.github.com/4149074 now redirects to gist.github.com/brandonb927/4149074 and I have updated the gist to reflect this new format
*
*/
(function(){
var gists = document.getElementsByTagName('gist');
@attilagyorffy
attilagyorffy / downgrade_to_node6.sh
Created November 7, 2016 15:07
How to downgrade Node to v6 LTS (Homebrew method)
# Things may stop working as you upgrade the version of node on your system.
# Using Homebrew's alternative repo (homebrew/versions) offers you legacy
# and earlier versions of formulae.
brew remove node --force
brew tap homebrew/versions
brew install homebrew/versions/node6-lts
@attilagyorffy
attilagyorffy / gist:7be7c5c226328fff61da2b7f69696ada
Created October 20, 2016 16:17
Surviving a FreeBSD upgrade
# Surviving a major #FreeBSD Upgrade:
1) Add your /etc under git
2) # freebsd-update upgrade -r 11.0-RELEASE
3) Review changes
4) # pkg-static install -f pkg
5) # pkg upgrade -y
6) # freebsd-update install
Win.
@attilagyorffy
attilagyorffy / puma-dev.log
Created August 4, 2016 18:39
An output to help diagnosing issues possibly caused by incompatibilities with the fish shell
# Taken from ~/Library/Logs/puma-dev.log
! Booted app 'testing' on socket /Users/attila/.puma-dev/testing/tmp/puma-dev-19549.sock
fish: Could not return shell to foreground
tcsetpgrp: Inappropriate ioctl for device
fish: Could not return shell to foreground
tcsetpgrp: Inappropriate ioctl for device
Could not send job 4 ('echo "begin; $argv "\n" ;end <&3 3<&-" | source 3<&0') to foreground
tcsetpgrp: Inappropriate ioctl for device
Could not send job 4 ('echo "begin; $argv "\n" ;end <&3 3<&-" | source 3<&0') to foreground
@attilagyorffy
attilagyorffy / migration-v1.rb
Last active July 25, 2016 21:15
Avoiding PG::NotNullViolation errors when adding new columns
class AddFirstAndLastNameToUsers < ActiveRecord::Migration
def change
add_column :users, :first_name, :string, null: false
add_column :users, :last_name, :string, null: false
end
end
@attilagyorffy
attilagyorffy / howto.txt
Created July 2, 2016 17:58
Install FreeBSD 10.3 with LibreSSL in base
# git clone https://github.com/attilagyorffy/freebsd.git /usr/src
# cd /usr/src
# git checkout releng/10.3-libressl
# make buildworld && make buildkernel && make installkernel && make installworld
# reboot
@attilagyorffy
attilagyorffy / make buildworld.out
Created June 26, 2016 15:26
Output of make buildworld
This file has been truncated, but you can view the full file.
# make buildworld
--------------------------------------------------------------
>>> World build started on Sun Jun 26 14:42:26 UTC 2016
--------------------------------------------------------------
--------------------------------------------------------------
>>> Rebuilding the temporary build tree
--------------------------------------------------------------
rm -rf /usr/obj/usr/src/tmp
rm -rf /usr/obj/usr/src/lib32