Skip to content

Instantly share code, notes, and snippets.

View TheNaoX's full-sized avatar
🌮
Tacos

Antonio Chavez TheNaoX

🌮
Tacos
View GitHub Profile
@TheNaoX
TheNaoX / vscode_settings.md
Created January 29, 2018 18:54
My VSCode settings

Extensions list

  • ESLint
  • HTML Snippets
  • Material Icon theme
  • Rainglow
  • Ruby
  • ruby-on-rails-snippets
  • ruby-snippet
  • Simple Ruby ERB
@TheNaoX
TheNaoX / bmi_test.rb
Created November 17, 2015 14:50
BMI example
weight = 85 # Kilograms
height = 1.77 # Meters
bmi = BodyMassIndex.new(weight, height)
bmi.calculate_index # 27.1
exports.up = function(knex, Promise) {
return knex.schema.hasTable('short_urls').then(function(exists) {
if (!exists) {
return knex.schema.createTable('short_urls', function(t) {
t.increments('id').primary();
t.text('long_url');
t.string('token', 11);
t.index(['token'], 'short_urls_token_idx')
t.timestamps();
});
// Update with your config settings.
module.exports = {
development: {
client: 'postgresql',
connection: {
database: 'db_name',
charset: 'utf8'
},
function parse_git_dirty {
git diff --quiet HEAD &>/dev/null
[[ $? == 1 ]] && echo "…"
}
if [ -n __git_ps1 ]; then
function parse_git_branch {
local branch=$(__git_ps1 "%s")
[[ $branch ]] && echo " $branch$(parse_git_dirty)"
}
fi
@TheNaoX
TheNaoX / checkboxes.scss
Created March 17, 2015 04:29
SASSy font awesome checkboxes.
input[type="checkbox"] {
display: none;
& + label {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
@TheNaoX
TheNaoX / generate_sdk_files.rb
Last active August 29, 2015 14:14
Generate unfingerprinted version of assets and uploading them to s3
class GenerateSDKFiles
FILE_NAMES = [ "application.js" ]
ONE_HOUR = 3600
def generate
Rails.logger.info "Started to sync libraries #{FILE_NAMES}"
FILE_NAMES.each do |file_name|
@TheNaoX
TheNaoX / server.rb
Created July 29, 2014 18:38
Polyglot server
['Chicho', "Toño"].each do |name|
puts "Ola k ase #{name}"
end
system "node app.js"
func makeIncrementer() -> (Int -> Int) {
func addOne(number: Int) -> Int {
return 1 + number
}
return addOne
}
var increment = makeIncrementer()
increment(7)
@TheNaoX
TheNaoX / mail.rb
Created February 4, 2014 23:46
Here's a basic example of how to use the Mail gem without action mailer on rails.
recipients = ['email@example.com']
mail_body = <<-HTML
Hello world!
HTML
mail = Mail.new do
delivery_method(
:smtp,
:address => "address",