Skip to content

Instantly share code, notes, and snippets.

View juanfgs's full-sized avatar

Juan Francisco Giménez Silva juanfgs

View GitHub Profile
@juanfgs
juanfgs / CommentsController.rb
Last active August 29, 2015 14:15
issues with recaptcha
View CommentsController.rb
class CommentsController < ApplicationController
def create
@post = Post.find(params[:comment][:post_id])
@comment = Comment.new
@comment.name = params[:comment][:name]
@comment.comment = params[:comment][:comment]
if verify_recaptcha(:model => @comment) && @comment.valid?
@post.comments << @comment
redirect_to :back, flash: {message: "Thank you for your comment "}
else
@juanfgs
juanfgs / mp4subtitles.sh
Created August 12, 2015 13:43
Set Wallpaper
View mp4subtitles.sh
#!/bin/sh
cd .;
ffmpeg -i $1 -vcodec copy -acodec copy temp.mkv;
CHARSET=`file -bi $2 | sed -e 's/.*[ ]charset=//'`;
if [ $CHARSET == "utf-8" ];then
cp $2 subtitle.srt;
else
iconv -f iso8859-15 -t UTF-8 $2 > subtitle.srt;
fi
mkvmerge -o $1.mkv temp.mkv --language "0:es" --track-name "0:mytrackname" -s 0 -D -A subtitle.srt;
View .emacs.el
;; Global Include
(add-to-list 'load-path ".../git/contrib/emacs")
(add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp"))
;; Theme & Appearance
;;(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/emacs-deviant-theme")
;;(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/emacs-colors-solarized")
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/smyx-master")
(set-face-attribute 'default nil :height 108) ;; font size
(defun enable-custom-theme ()
View config.txt
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
View merge-release-major.sh
#!/bin/bash
inc()
{
shopt -s extglob
num=$(echo "$release_version" | sed 's/^\([0-9]*\)\.[0-9]*\.[0-9]*/\1/g')
let num++
echo "$num.0.0"
}
View merge-release-minor.sh
#!/bin/bash
inc()
{
shopt -s extglob
num=$(echo "$release_version" | sed 's/^[0-9]*\.\([0-9]*\)\.[0-9]*/\1/g')
let num++
echo $release_version | sed -r "s/^([0-9]*)\.[0-9]*\.[0-9]*$/\1.$num.0/"
}
View aliases.txt
[alias]
brr = branch -r
br = branch
ci = commit -m
cia = commit -a -m
amend = commit --amend -C HEAD
co = checkout
cob = checkout -b
st = status -sb
me = merge --no-ff
View merge-release-patch.sh
#!/bin/bash
inc()
{
shopt -s extglob
num=$(echo "$release_version" | sed 's/^[0-9]*\.[0-9]*\.//g')
let num++
echo $release_version | sed -r s/[0-9]*$/$num/
}
View Rakefile.rb
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << ["spec", "lib" ]
t.pattern = "spec/**/*_spec.rb"
end
@juanfgs
juanfgs / Gemfile
Created December 5, 2017 23:02
Implementation
View Gemfile
source 'https://rubygems.org/'
gem 'minitest'