Skip to content

Instantly share code, notes, and snippets.

View nauman's full-sized avatar
🚀
Need MVP? book me in https://tidycal.com/nauman

Nauman Tariq nauman

🚀
Need MVP? book me in https://tidycal.com/nauman
View GitHub Profile
@brandondees
brandondees / authentication_token.rb
Created September 17, 2015 20:06
Stronger Authentication Tokens
# == Schema Information
#
# Table name: authentication_tokens
#
# created_at :datetime
# expires_at :datetime
# hashed_token :string(255)
# id :integer not null, primary key
# ip_address :string(255)
# updated_at :datetime
@vdaubry
vdaubry / base_controller.rb
Last active September 18, 2015 00:53
Sample token authentication
class Api::V1::BaseController < ActionController::Base
before_filter :allow_cors
def allow_cors
headers["Access-Control-Allow-Origin"] = "*"
headers["Access-Control-Allow-Methods"] = %w{GET POST PUT DELETE}.join(",")
headers["Access-Control-Allow-Headers"] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token X-API-Auth-Token}.join(",")
end
def options
@ianaya89
ianaya89 / .bash_profile
Last active October 20, 2017 11:28
Custom Setting for Mac Terminal
# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
# Showing Git Branch.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@WattsInABox
WattsInABox / .gitignore
Last active July 5, 2024 09:36
Generate Static HTML Website Using Ruby on Rails
# Ignore static version of the site (used to upload error pages to S3 for Heroku errors)
/out
@rosswd
rosswd / multi-git-win.md
Last active December 30, 2024 13:49
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
    • In the installer, select everything but decide if you want a desktop icon (2nd step)
@ryansobol
ryansobol / gist:5252653
Last active February 23, 2025 06:28
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@djburdick
djburdick / gist:5027494
Last active August 8, 2023 05:52
Redis rails commands. #rails #redis
Rails.redis.get(key)
Rails.redis.set(key, value)
Rails.redis.expire(key, 1.hour)
Rails.redis.del(key)
Rails.redis.sadd(set_name, value)
Rails.redis.srem(set_name, key)
Rails.redis.sismember(set_name, value) # boolean test to see if val exists
@markbates
markbates / gist:4240848
Created December 8, 2012 16:06
Getting Started with Rack

If you're writing web applications with Ruby there comes a time when you might need something a lot simpler, or even faster, than Ruby on Rails or the Sinatra micro-framework. Enter Rack.

Rack describes itself as follows:

Rack provides a minimal interface between webservers supporting Ruby and Ruby frameworks.

Before Rack came along Ruby web frameworks all implemented their own interfaces, which made it incredibly difficult to write web servers for them, or to share code between two different frameworks. Now almost all Ruby web frameworks implement Rack, including Rails and Sinatra, meaning that these applications can now behave in a similar fashion to one another.

At it's core Rack provides a great set of tools to allow you to build the most simple web application or interface you can. Rack applications can be written in a single line of code. But we're getting ahead of ourselves a bit.

//app.js
Titanium.UI.setBackgroundColor('#000');
//create window
var win = Titanium.UI.createWindow({
title:'Countdown Main',
modal: true,
exitOnClose: true
});
@doublerebel
doublerebel / checkboxwidget.coffee
Created October 11, 2012 21:27
Example of a Tiger View Widget: Checkbox with Label
dip = (val) -> "#{val} dip"
class Settings.CheckBox extends Tiger.View
defaults:
width: '92%'
height: dip 48
# style: Ti.UI.Android.SWITCH_STYLE_CHECKBOX
constructor: (props) ->
@label = new Tiger.Label