Skip to content

Instantly share code, notes, and snippets.

View iwan's full-sized avatar

Iwan Buetti iwan

  • Milano, Italy
View GitHub Profile
@moertel
moertel / suppress_ruby_output.rb
Last active March 21, 2024 08:54
Temporarily suppress STDOUT and STDERR (ruby)
# Temporarily redirects STDOUT and STDERR to /dev/null
# but does print exceptions should there occur any.
# Call as:
# suppress_output { puts 'never printed' }
#
def suppress_output
original_stderr = $stderr.clone
original_stdout = $stdout.clone
$stderr.reopen(File.new('/dev/null', 'w'))
$stdout.reopen(File.new('/dev/null', 'w'))
@iwan
iwan / route.rb
Last active August 29, 2015 13:59 — forked from vparihar01/route.rb
# NOTE below gems are only for development purpose can be removed and commented out as per requirement
group :development do
gem 'rails-erd','1.0.0'
gem 'hirb','0.7.0'
gem 'railroady'
gem 'itslog','0.6.1'
gem 'quiet_assets'
gem 'sextant' # now included in Rails 4.0
end
@magicznyleszek
magicznyleszek / jekyll-and-liquid.md
Last active January 12, 2024 03:46
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@didats
didats / nationality.html
Created December 28, 2013 00:00
Nationality List in HTML Dropdown
<select name="nationality">
<option value="">-- select one --</option>
<option value="afghan">Afghan</option>
<option value="albanian">Albanian</option>
<option value="algerian">Algerian</option>
<option value="american">American</option>
<option value="andorran">Andorran</option>
<option value="angolan">Angolan</option>
<option value="antiguans">Antiguans</option>
<option value="argentinean">Argentinean</option>
@tomas-stefano
tomas-stefano / Capybara.md
Last active May 2, 2024 05:16
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@vparihar01
vparihar01 / printingJavascriptObject.js
Created June 25, 2013 13:23
for printing down the javascript [object Object] value.This get all properties values of a Javascript Object (without knowing the keys).
for(var key in objects) {
var value = objects[key];
}
Object.values = function (obj) {
var vals = [];
for( var key in obj ) {
if ( obj.hasOwnProperty(key) ) {
vals.push(obj[key]);
}
@biovisualize
biovisualize / README.md
Last active July 29, 2019 14:42
Test for attaching a png to a gist
  1. Create a new public gist on https://gist.github.com/
  2. Under "Clone this gist", copy the link (i.e., https://gist.github.com/4415518.git)
  3. If you have the command line git tools, clone this gist to a local folder: git clone https://gist.github.com/4415518.git
  4. It will add a folder with the gist id as a name (i.e., 4415518) under the current working directory. Navigate to this folder in the command line: cd 4415518 (dir 4415518 on windows)
  5. Navigate to this folder in your file explorer and add an image (i.e., test.png)
  6. Add it to git from the command line: git add test.png
  7. Commit it to git: git commit -m "I just added a file!"
  8. Push this commit to your remote gist (you will need your Github user name and password): git push
  9. Go back and refresh your Gist on https://gist.github.com/ to confirm that it worked
@albertgrala
albertgrala / coffescript.coffee
Created December 9, 2012 00:33
Sandbox: CoffeeScript jQuery hover
# $('.drink li').hover(function() {
# $(this).find('span').show();
# }, function() {
# $(this).find('span').hide();
# });
$('.drink li').hover(
->
$(@).find('span').show()
->
$(@).find('span').hide()
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@McKinneyDigital
McKinneyDigital / share-twitter.js
Created June 6, 2012 20:21
Share to Twitter from a link using Javascript
// Opens a pop-up with twitter sharing dialog
var url = "http://google.com";
var text = "Replace this with your text";
window.open('http://twitter.com/share?url='+encodeURIComponent(url)+'&text='+encodeURIComponent(text), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');