- Open System Preferences, select Users & Groups
- Click the lock and enter your password to unlock the panel
- Click Login Options, then click the Join button
- Click Open Directory Utility button
- Now go up to the Edit menu and select Enable Root User
- Enter a password and voila, root is enabled
- Later, after the rest is done, you need to retrace these steps and select Disable Root User
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :ci do | |
task :copy_yml do | |
sh "cp #{Rails.root}/config/example_database.yml #{Rails.root}/config/database.yml" | |
sh "other preparation" | |
end | |
desc "Prepare for CI and run entire test suite" | |
task :build do | |
Rake::Task['db:migrate'].invoke | |
Rake::Task['db:test:prepare'].invoke |
Assume we have Nginx installed on Ubuntu 12.04 server. Now I will show you how to configure HTTP basic authentication in Nginx.
step1:
Open conf/nginx.conf file, and add some directives into locatiion / section:
location / {
auth_basic "Restricted";
auth_basic_user_file pwd;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo aptitude -y install nginx | |
cd /etc/nginx/sites-available | |
sudo rm default | |
sudo cat > jenkins | |
upstream app_server { | |
server 127.0.0.1:8080 fail_timeout=0; | |
} | |
server { | |
listen 80; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# check if an input filename was passed as a command | |
# line argument: | |
if [ ! $# == 1 ]; then | |
echo "Please specify the name of a file to split!" | |
exit | |
fi | |
# create a directory to store the output: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.random(n = 1) | |
indexes = (0..self.count-1).sort_by{rand}.slice(0,n).collect! | |
if n == 1 | |
return self.skip(indexes.first).first | |
else | |
return indexes.map{ |index| self.skip(index).first } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.4/mapbox.js'></script> | |
<script src='http://d3js.org/d3.v2.min.js?2.9.3'></script> | |
<link | |
href='http://api.tiles.mapbox.com/mapbox.js/v0.6.4/mapbox.css' | |
rel='stylesheet' /> | |
<style> | |
body { margin:0; padding:0; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This depends a lot on what you mean by "revert". | |
If you want to temporarily go back to it, fool around, then come back to where you are, all you have to do is check out the desired commit: | |
# this will detach your HEAD, i.e. leave you with no branch checked out. | |
git checkout 0d1d7fc32 | |
or if you want to make commits while you're there, go ahead and make a new branch while you're at it: | |
git checkout -b old-state 0d1d7fc32 | |
If, on the other hand, you want to really get rid of everything you've done since then, there are two possibilities. One, if you haven't published any of these commits, simply reset: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def dummy_image wxh | |
image_tag "http://dummyimage.com/#{wxh}/999/eee.png",size: wxh | |
end | |
def dummy_paragraph(count = 3) | |
Faker::Lorem.paragraph(count) | |
end |