Skip to content

Instantly share code, notes, and snippets.

@pedro-santiago
pedro-santiago / migrate.sh
Last active November 18, 2020 22:20 — forked from gghughunishvili/migrate1.sh
Upgrade MAMP 4 to Mysql 5.7.18 (on Sierra tested)
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-macos10.12-x86_64.tar.gz
tar xfvz mysql-5.7.18-macos10.12-x86_64.tar.gz
echo "Stopping MAMP"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "Copy Bin"
@david-meza
david-meza / roman_numerals.rb
Last active November 9, 2023 10:01
Convert arabic to roman numerals in Ruby
class Fixnum
# Constant variable with 'unique' roman numerals, plus some special cases (e.g. "IV, IX, XC, CM...")
ROMANS = { 1000 => "M",
900 => "CM",
500 => "D",
400 => "CD",
100 => "C",
90 => "XC",
50 => "L",
@stefanneculai
stefanneculai / AWS_CONFIG.rb
Last active June 26, 2019 05:29
Amazon Signature Ruby
AWS_CONFIG = {
'access_key_id' => YOUR_ACCESS_KEY,
'secret_access_key' => YOUR_SECRET_ACCESS_KEY,
'bucket' => 'froala',
'acl' => 'public-read',
'key_start' => 'uploads/',
'region' => 's3' # For other regions than us-east-1, use s3-region. E.g.: s3-eu-west-1
}
@dklisiaris
dklisiaris / rails-boilerplate.md
Last active August 18, 2017 05:58
A manual setup for a typical rails 4.x. app with bootstrap layout, devise authentication, rspec testing framework with capybara and git version control.

Setup a new project and database.

Create a new rails app named app_name without Test::Unit and with mysql database:

rails new app_name -T -d mysql

or an app without Test::Unit and with postgresql database:

rails new app_name -T -d postgresql

or without Test::Unit and with the default sqlite:

@yitsushi
yitsushi / EventSystem.js
Created May 6, 2014 09:52
EventSystem that I use with React.js to communicate between components
var EventSystem = (function() {
var self = this;
self.queue = {};
return {
publish: function (event, data) {
var queue = self.queue[event];
if (typeof queue === 'undefined') {
@benmj
benmj / geocoder-service.js
Created August 29, 2013 16:38
An AngularJS Service for intelligently geocoding addresses using Google's API. Makes use of localStorage (via the ngStorage package) to avoid unnecessary trips to the server. Queries Google's API synchronously to avoid `google.maps.GeocoderStatus.OVER_QUERY_LIMIT`
/*global angular: true, google: true, _ : true */
'use strict';
angular.module('geocoder', ['ngStorage']).factory('Geocoder', function ($localStorage, $q, $timeout) {
var locations = $localStorage.locations ? JSON.parse($localStorage.locations) : {};
var queue = [];
// Amount of time (in milliseconds) to pause between each trip to the
@ferronrsmith
ferronrsmith / ordinal.js
Created May 22, 2013 20:37
angular ordinal filter
'use strict';
// Ordinal Number Filter
// ---------------------
// This filter takes a number and returns its ordinal value
// i.e. 1 -> 1st, 2 -> 2nd, etc.
// h/t http://ecommerce.shopify.com/c/ecommerce-design/t/ordinal-number-in-javascript-1st-2nd-3rd-4th-29259
angular.module('ordinal', []).filter('ordinal', function() {