Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Antonio Chavez TheNaoX

🎯
Focusing
View GitHub Profile
View vscode_settings.md

Extensions list

  • ESLint
  • HTML Snippets
  • Material Icon theme
  • Rainglow
  • Ruby
  • ruby-on-rails-snippets
  • ruby-snippet
  • Simple Ruby ERB
View bmi_test.rb
weight = 85 # Kilograms
height = 1.77 # Meters
bmi = BodyMassIndex.new(weight, height)
bmi.calculate_index # 27.1
View migrations.js
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();
});
View knexfile.js
// Update with your config settings.
module.exports = {
development: {
client: 'postgresql',
connection: {
database: 'db_name',
charset: 'utf8'
},
View ps1.sh
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 Mar 17, 2015
SASSy font awesome checkboxes.
View checkboxes.scss
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 Aug 29, 2015
Generate unfingerprinted version of assets and uploading them to s3
View generate_sdk_files.rb
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 Jul 29, 2014
Polyglot server
View server.rb
['Chicho', "Toño"].each do |name|
puts "Ola k ase #{name}"
end
system "node app.js"
View example.swift
func makeIncrementer() -> (Int -> Int) {
func addOne(number: Int) -> Int {
return 1 + number
}
return addOne
}
var increment = makeIncrementer()
increment(7)
@TheNaoX
TheNaoX / mail.rb
Created Feb 4, 2014
Here's a basic example of how to use the Mail gem without action mailer on rails.
View mail.rb
recipients = ['email@example.com']
mail_body = <<-HTML
Hello world!
HTML
mail = Mail.new do
delivery_method(
:smtp,
:address => "address",
You can’t perform that action at this time.