Skip to content

Instantly share code, notes, and snippets.


Nicolay Hvidsten nicohvi

View GitHub Profile
jonathantneal /
Last active May 22, 2020
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\"
thebucknerlife /
Last active Mar 5, 2021
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault


View Blur-on-Scroll-+-Simple-Parallax.markdown

Blur on Scroll + Simple Parallax

This pen demonstrates a simple blur image on scroll and content parallax. It gets the scroll position using requestAnimationFrame instead of an onScroll event.

A Pen by A973C on CodePen.


View install consolas on mac
# Thanks to this post:
$ brew install cabextract
$ cd ~/Downloads
$ mkdir consolas
$ cd consolas
$ curl -O
$ cabextract PowerPointViewer.exe
$ cabextract
View gist:7248868
function LolCat () {
// Private variabler og metoder
var foods = ['cheezburgerz', 'icecriim', 'your dinner'];
function likes (food) {
return foods.indexOf(food) !== -1;
// Såkalte priviliged variabler og metoder: De har tilgang til private variabler, men kan brukes utenfra
mattconnolly / gist:4158961
Created Nov 28, 2012
RSpec basic authentication helper module for request and controller specs
View gist:4158961
module AuthHelper
def http_login
user = 'username'
pw = 'password'
request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user,pw)
module AuthRequestHelper
unixmonkey / Cucumber Plain Text Feature.tmLanguage
Created Mar 10, 2011
Cucumber Language definition file for TextMate; modified to work with Sublime Text 2
View Cucumber Plain Text Feature.tmLanguage
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>기능|機能|功能|フィーチャ|خاصية|תכונה|Функціонал|Функционалност|Функционал|Особина|Могућност|Özellik|Właściwość|Tính năng|Savybė|Požiadavka|Požadavek|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Fīča|Funzionalità|Funktionalität|Funkcionalnost|Funkcionalitāte|Funcționalitate|Functionaliteit|Functionalitate|Funcionalitat|Funcionalidade|Fonctionnalité|Fitur|Feature|Egenskap|Egenskab|Crikey|Característica|Arwedd(.*)</string>
niklas / rails-fields-with-errors-get-class-by-nokogiri.rb
Created Jan 9, 2011
Add .error CSS class to all invalid form fields. Rails wraps them in div.fieldWithErrors, which still sucks in 3.0
View rails-fields-with-errors-get-class-by-nokogiri.rb
# put this in config/initializer/fields_with_errors.rb
ActionView::Base.field_error_proc = do |html_tag, instance|
if html_tag =~ /<(input|label|textarea|select)/
error_class = 'error'
doc = Nokogiri::XML(html_tag)
doc.children.each do |field|
unless field['type'] == 'hidden'
unless field['class'] =~ /\berror\b/