Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hadifarnoud's full-sized avatar

Hadi Farnoud hadifarnoud

View GitHub Profile
@hadifarnoud
hadifarnoud / api.js
Created September 26, 2016 14:44 — forked from fwielstra/api.js
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
fa:
devise:
failure:
invited: "شما یک دعوت نامه در حال انتظار دارید، با قبول آن حساب خود را بسازید."
invitations:
send_instructions: "یک ایمیل دعوت نامه به %{email} ارسال شد."
invitation_token_invalid: "کد دعوت نامه معتبر نیست!"
updated: "رمز عبور شما ذخیره شد. شما وارد سایت شدید!"
updated_not_active: "رمز عبور شما ذخیره شد."
no_invitations_remaining: "دعوت نامه ای نمانده"

Keybase proof

I hereby claim:

  • I am hadifarnoud on github.
  • I am hadifarnoud (https://keybase.io/hadifarnoud) on keybase.
  • I have a public key whose fingerprint is 348A A16A 2BD7 1E3F AA6E B739 9903 D205 63E9 E34B

To claim this, I am signing this object:

@hadifarnoud
hadifarnoud / gist:db45c8656e479444e39f
Last active August 29, 2015 14:27 — forked from jrochkind/gist:2161449
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

sudo apt-get update
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
sudo curl http://nginx.org/keys/nginx_signing.key | apt-key add -
sudo echo -e "deb http://nginx.org/packages/mainline/ubuntu/ `lsb_release -cs` nginx\ndeb-src http://nginx.org/packages/mainline/ubuntu/ `lsb_release -cs` nginx" > /etc/apt/sources.list.d/nginx.list
sudo apt-get install -y vim curl python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5
sudo add-apt-repository -y ppa:nginx/stable
@hadifarnoud
hadifarnoud / dns.php
Last active August 29, 2015 14:09 — forked from horsley/dns.php
<?php
$result = array();
$result_html = '';
if (isset($_POST['domain']) && !empty($_POST['domain'])) {
$domain_regex = '/[a-z\d][a-z\-\d\.]+[a-z\d]/i';
if (preg_match($domain_regex, $_POST['domain'])) {
if ($url = parse_url($_POST['domain'])) { //compatible when user post an url instead of a domain
if (isset($url['host'])) {
$result = dns_get_record($url['host'], DNS_A + DNS_AAAA + DNS_CNAME);
} else if (isset($url['path'])) {
```
brew update
brew install bash
sudo sh -c 'echo "/usr/local/bin/bash" >> /etc/shells'
chsh -s /usr/local/bin/bash
sudo mv /bin/bash /bin/bash-backup
sudo ln -s /usr/local/bin/bash /bin/bash
```
#!/bin/bash
# This script is used for create virtual hosts on CentOs.
# Created by alexnogard from http://alexnogard.com
# Feel free to modify it
# PARAMETERS
#
# $usr - User
# $dir - directory of web files
# $servn - webserver address without www.
# $cname - cname of webserver
<!doctype html>
<html>
<head>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<meta charset="UTF-8">
<title>Example Google Map</title>
</head>
<body>
@hadifarnoud
hadifarnoud / gist:8082351
Created December 22, 2013 13:02
Install Ruby and Ruby on Rails environment
install Homebrew if you don't have it already
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
then install rbenv and ruby-build
$ brew install rbenv ruby-build
finally, install Ruby and Rails
$ rbenv install 2.0.0-p353