Skip to content

Instantly share code, notes, and snippets.

@hipertracker
hipertracker / gist:734305
Created December 9, 2010 03:40
Benchmarks Ruby vs Python vs PHP
For MacBook Pro, Core Duo 2, 2.8GHz, Mac OS-X 10.6.5
https://gist.github.com/734280 - fraktals
1. PyPy 1.4 = 0.41 s.
2. MacRuby 0.7.1 (ruby 1.9.2) = 2.08 s.
3. Maglev 0.8 (ruby 1.8.7) = 6.23 s.
4. Rubinius 1.1.1 = 7.54 s.
5. JRuby 1.5.6 = 12.22 s.
6. Ruby 1.9.2p0 = 14.65 s.
@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@ArnaudLigny
ArnaudLigny / Narno_Gettext_Model_Translate.php
Last active September 29, 2015 23:47
Use Gettext to translate Magento modules
<?php
/**
* Narno Gettext Translate model
* (overlap of Mage_Core_Model_Translate)
*
* Support Gettext file (binary).
*/
class Narno_Gettext_Model_Translate extends Mage_Core_Model_Translate
{
[...]
/*
* FancyBox - jQuery Plugin
* Simple and fancy lightbox alternative
*
* Examples and documentation at: http://fancybox.net
*
* Copyright (c) 2008 - 2010 Janis Skarnelis
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
*
* Version: 1.3.4 (11/11/2010)
@hiono
hiono / add_ssh_config.sh
Last active October 24, 2016 14:03
Add a vagrant ssh-config data to ".ssh/config" file. Require plugin: vagrant-global-status
#!/bin/bash
SSH=$HOME/.ssh
[ ! -f $SSH/config ] && touch $SSH/config
[ -f $SSH/config ] && [ ! -f $SSH/config.orig ] && mv $SSH/config{,.orig}
rm -f $SSH/config.vagrant
touch $SSH/config.vagrant
for dir in $(vagrant global-status | grep $HOME)
do
pushd $dir > /dev/null
@sneal
sneal / Vagrantfile.rb
Last active May 13, 2023 15:06
Gem install from Vagrantfile
require "rubygems"
# Install the Chef gem into the private Vagrant gem repo
CHEF_VERSION = '11.8.2'
def with_vagrant_gem_path
@old_gem_path = ENV["GEM_PATH"]
@old_gem_home = ENV["GEM_HOME"]
Gem.paths = ENV["GEM_PATH"] = ENV["GEM_HOME"] = "#{ENV['HOME']}/.vagrant.d/gems"
return yield
@bmihaylov
bmihaylov / getgist
Created March 17, 2014 12:04
Download and unpack a gist with curl
#!/bin/sh
curl "$1/download" | tar zx --strip-components 1
@frozenminds
frozenminds / clean-magento_ce-db-extended.sql
Created May 12, 2014 12:54
Clean Magento database of junk and unnecessary data
--
-- Magento CE database clean-up extended
--
-- This is an extended clean-up which will clean search, import/export, reports, etc.
--
-- @author Constantin Bejenaru <[email protected]>
-- @copyright Copyright (c) Constantin Bejenaru (http://frozenminds.com/)
-- @license http://www.opensource.org/licenses/mit-license.html MIT License
--
@jashkenas
jashkenas / semantic-pedantic.md
Last active September 5, 2024 17:03
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

@ledlogic
ledlogic / EEPROMExample.ino
Created January 24, 2015 16:28
Example for Arduino EEPROM read / writes
/////////////////////////////////////////////////////////////////
// Created by Kevin Elsenberger //
// June 2, 2013 //
// elsenberger.k at gmail.com //
// from http://playground.arduino.cc/Code/EEPROMReadWriteLong //
/////////////////////////////////////////////////////////////////
//Needed to access the eeprom read write functions
#include <EEPROM.h>