This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Open stdout and stderr streams and start external executable with timeout. | |
# The timeout is given in seconds. | |
# | |
# Block form: | |
# | |
# exec_with_timeout(timeout, [env,] cmd... [, opts]) {|stdout, stderr| | |
# stdout.read | |
# ... | |
# } | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CitiesController < ApplicationController | |
def all_by_state_id | |
uf = params[:id] | |
cities = City.joins(:state).where('states.id' => uf).select('cities.id, cities.name') | |
render :json => { data: { cities: cities } } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns the string with accented and non-standard Latin-based characters converted into ASCII approximate equivalents. | |
* | |
* @returns {String} | |
*/ | |
String.prototype.normalize = function() { | |
var NormalizeSource = { | |
'A': /[AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ]/g, | |
'B': /[BⒷBḂḄḆɃƂƁ]/g, | |
'C': /[CⒸCĆĈĊČÇḈƇȻꜾ]/g, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Replaces any ${variables} in the template string by the data object | |
*/ | |
var parseTemplate = function(template, data) { | |
return template.replace(/\$\{([\w\d]+)\}/g, function(token, variable){ | |
return data[variable]; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ========================================================= # | |
# MyEzBkp | |
# Easy and simple backup of your entire MySQL Server. | |
# | |
# Ver: 1.0 | |
# By: Kriansa | |
# | |
# This script requires root privileges to run! | |
# Tested only in RHEL based distros (Fedora & CentOS) |
NewerOlder