Skip to content

Instantly share code, notes, and snippets.

@jamster
jamster / git_commit_parser.rb
Created March 22, 2011 17:32
quick script to parse git logs and turn them to a data structure
# Usage:
# git log | ruby git_commit_parser.rb
# https://gist.github.com/881641
# By: Jason Amster
# jayamster@gmail.com
require 'rubygems'
require 'pp'
logs = STDIN.read
logs = logs.split("commit ")
@jakzal
jakzal / deploy.rb
Created November 28, 2011 16:11
Updating assets version before assetic dump (capifony)
namespace :symfony do
namespace :assets do
desc "Updates assets version"
task :update_version do
run "sed -i 's/\\(assets_version: \\)\\(.*\\)$/\\1 #{real_revision}/g' #{latest_release}/app/config/config.yml"
end
end
end
before "symfony:assetic:dump" do
#Use Apache as proxy for VM based on local DNS resolution
<VirtualHost *:80>
ServerName vm.example.com
ServerAlias *.vm.example.com
RewriteEngine on
RewriteCond %{HTTP_HOST} (.*)\.vm\.example\.com$
RewriteRule (.*)$ http://%1.vm.example.com/$1 [P]
</VirtualHost>
# http://darrinholst.com/post/18231749247
desc "tail log files"
task :tail, :roles => :app do
run "tail -f #{shared_path}/log/#{rails_env}.log" do |channel, stream, data|
puts "#{channel[:host]}: #{data}"
break if stream == :err
end
end
@hopsoft
hopsoft / db.rake
Last active July 5, 2024 14:52
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@meleyal
meleyal / .scss-lint.yml
Created August 13, 2014 16:45
scss-lint `PropertySortOrder` config based on @mdo's Code Guide / recess
# based on http://git.io/hpl2Gw
linters:
PropertySortOrder:
order:
- position
- top
- right
- bottom
- left
@yang-wei
yang-wei / destructuring.md
Last active July 4, 2024 16:56
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
// app/redux/action-creators.es6.js
import {SET_ROUTE} from 'app/redux/action-types';
export const setRoute = (route) => {
return {
type: SET_ROUTE,
route
};
};
@bjoern-r
bjoern-r / Huawei_E3372_openwrt.md
Last active July 9, 2024 08:11
How to use a Huawei E3372 on OpenWRT

HOWTO use a Huawei E3372 on OpenWRT

This modem is also sold as a MegaFon M150-2 USB dongle

Needed Software

Install the needed packages via opkg tool

opkg update
@fernandoaleman
fernandoaleman / mysql2-mojave.md
Last active February 7, 2024 19:19
Install mysql2 on MacOS Mojave

For MacOS Catalina, visit Install mysql2 on MacOS Catalina

Problem

Installing mysql2 gem errors on MacOS Mojave.

Solution

Make sure openssl is installed on Mac via Homebrew.