Skip to content

Instantly share code, notes, and snippets.

View hasghari's full-sized avatar

Hamed Asghari hasghari

  • G2
  • Salt Lake City, UT
View GitHub Profile
fernandoaleman / fix-libv8-mac.txt
Created May 5, 2016 15:14
Fixing libv8 and therubyracer on Mac
View fix-libv8-mac.txt
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
bundle install
mbajur / .md
Created April 29, 2016 07:16
How to create small, unique tokens in Ruby
View .md

How to create small, unique tokens in Ruby

That is is basically a "fork" of blog article i'm constantly returning to. It seems that the blog is down:

My choice: Dave Bass’s rand().to_s() trick

Dave Bass proposed this which I picked up for my implementation (here for an 8-chars token):

moshekaplan /
Created August 29, 2014 14:18
Selenium cookies to Mechanize
import mechanize
import cookielib
import selenium.webdriver
# Create a selenium instance for browsing web pages
driver = selenium.webdriver.Firefox()
# ... Perform some actions
# Grab the cookie
rob-murray / add_intellij_launcer
Last active November 10, 2023 12:31
Add Intellij launcher shortcut and icon for ubuntu
View add_intellij_launcer
// create file:
sudo vim /usr/share/applications/intellij.desktop
// add the following
[Desktop Entry]
sj26 / apple_record.rb
Created June 23, 2013 04:58
How I do STI: Utilize descendent tracking and override model_name so they use the same URL helpers and parameters as their base class. Makes things like responders and form_for work as expected, while preserving things like to_partial_path.
View apple_record.rb
class AppleRecord < Record
linjunpop /
Last active August 14, 2021 05:42
Capybara, Rspec, Rails assets pipeline
joshkurz / app.js
Created August 9, 2012 03:21
View app.js
var demoApp = angular.module('demoApp', ['ngResource'], function($locationProvider) {
function MainCtrl($scope, Serv) {
$scope.selectedItem = {
value: 0,
label: ''
$scope.Wrapper = Serv;
iiska / db_fixtures_dump.rake
Created December 28, 2011 13:17
Dump Rails db to fixtures
View db_fixtures_dump.rake
# Original from by MichaelBoutros
# Optimized version which uses to_yaml for content creation and checks
# that models are ActiveRecord::Base models before trying to fetch
# them from database.
namespace :db do
namespace :fixtures do
desc 'Dumps all models into fixtures.'
task :dump => :environment do
models = Dir.glob(RAILS_ROOT + '/app/models/**.rb').map do |s|