Skip to content

Instantly share code, notes, and snippets.

View intrip's full-sized avatar
:octocat:
Coding, fun!

Jacopo Beschi intrip

:octocat:
Coding, fun!
View GitHub Profile
@bowsersenior
bowsersenior / stooge_loader.rb
Created May 18, 2011 23:18
A demo of YAML anchors, references and nested values
require 'rubygems'
require 'yaml'
# A demonstration of YAML anchors, references and handling of nested values
# For more info, see:
# http://atechie.net/2009/07/merging-hashes-in-yaml-conf-files/
stooges = YAML::load( File.read('stooges.yml') )
# => {
# "default" => {
@kates
kates / search_and_replace.sh
Last active August 31, 2019 05:22
bulk search and replace with the silver searcher, awk, sed and xargs
ag "sometext" --nogroup | awk '{print substr($1,1,index($1,":")-1);}' | xargs -I {} sed -i .bak -e 's/sometext/anothertext/g' {}
@gotohr
gotohr / gist:7005197
Created October 16, 2013 09:36
declarative function composition - golang
package main
import "fmt"
type F func(i int) int
func (f F) compose(inner F) F {
return func(i int) int { return f(inner(i)) }
}
@isimmons
isimmons / gulpfile.js
Last active August 29, 2015 13:55
gulpfile for gulp.js + Laravel: Compile sass/coffee, run phpunit tests, livereload css, js, and blade templates
/*
See dev dependencies https://gist.github.com/isimmons/8927890
Compiles sass to compressed css with autoprefixing
Compiles coffee to javascript
Livereloads on changes to coffee, sass, and blade templates
Runs PHPUnit tests
Watches sass, coffee, blade, and phpunit
Default tasks sass, coffee, phpunit, watch
*/
@bruceoutdoors
bruceoutdoors / DbmigrateController.php
Last active June 2, 2019 12:30
Laravel 4 Convert existing MySQL database to migrations. This is a fork of Christopher Pitt's work http://laravelsnippets.com/snippets/convert-an-existing-mysql-database-to-migrations, which is based off michaeljcalkins's work at http://paste.laravel.com/1jdw#sthash.0nEgQzQR.dpuf. His original source code doesn't really work out of the box in my…
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
@idleberg
idleberg / Install-Mcrypt.md
Last active May 31, 2023 17:13
Install Mcrypt on macOS

Setup php-mcrypt on macOS (and versions of Mac OS X)

These steps should have been mentioned in the prerequisites of the Laravel Installation Guide, since I'm surely not the only person trying to get Laravel running on macOS.

Install

Install Mcrypt using Homebrew and PECL (comes with PHP)

# PHP 7.3
@nybblr
nybblr / rails-with-bower.md
Last active November 27, 2023 15:41
Rails with Bower. Without bower-rails.
@chadbrewbaker
chadbrewbaker / zdist.rb
Created January 6, 2015 02:07
Computes information distance between two files
require "zlib"
if(ARGV.length != 2)
puts "usage: ruby zdist.rb file1 file2"
else
f1 = File.read(ARGV[0])
f2 = File.read(ARGV[1])
f1d = Zlib::Deflate.deflate(f1)
f2d = Zlib::Deflate.deflate(f2)
compressed = Zlib::Deflate.deflate(f1+f2)
@intrip
intrip / .vimrc
Last active March 14, 2017 17:01
Custom .vimrc for ruby and javascript development
""""""""""""""""""
" Vundle options
"""""""""""""""""
set nocompatible " be iMproved, required
filetype off " required
:let mapleader = "-" " Maps - as leader character
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
@rafaelfranca
rafaelfranca / 28718.rb
Last active July 4, 2022 20:11 — forked from alexcameron89/28718.rb
A Reproduction Script for Rails issue #28718
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", "5.0.2"