Skip to content

Instantly share code, notes, and snippets.

View marcoslebron's full-sized avatar
🖐️

Marcos Lebron marcoslebron

🖐️
View GitHub Profile
# install build dependencies
sudo yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel
# clone and install rbenv environment
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
@marcoslebron
marcoslebron / shopify-flexslider.liquid
Created November 4, 2020 06:22 — forked from bmodena/shopify-flexslider.liquid
Shopify Flexslider Integration with theme settings
<!-- add to head of your theme.liquid after moving the files into the assets folder | https://www.woothemes.com/flexslider/ -->
<!-- add only if you theme is not already including Jquery-->
{{ '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' | script_tag }}
<!-- FLEX Slider css and .js -->
{{ 'flexslider.css' | asset_url | stylesheet_tag }}
{{ 'jquery.flexslider.js' | asset_url | script_tag }}
<!--
add to schema json
@marcoslebron
marcoslebron / gist:8dc5f02e0579e7be9ec8595b36c4fd04
Created September 7, 2020 16:09 — forked from grandmanitou/gist:8863248
Place multiple markers with infowindow on Google Maps API v3, use external links to trigger click and center map on desired location.
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?language=fra&amp;sensor=false"></script>
<script type="text/javascript">
var map;
var Markers = {};
var infowindow;
var locations = [
[
'Samsung Store Madeleine',
'<strong>Samsung Store Madeleine</strong><p>5 Boulevard Malesherbes, 75008 Paris<br>10h – 20h</p>',
48.8701925,
@marcoslebron
marcoslebron / Install_tmux
Created June 26, 2018 20:03 — forked from simme/Install_tmux
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@marcoslebron
marcoslebron / ajax_Form.js
Created April 24, 2018 11:35
rails ajax form js
$('#signup-button').click(function (e) {
e.preventDefault();
var $form = $('.registration-form');
var postData = $form.serialize();
var formURL = $form.attr("action");
var validForm = validateFormRequiredField('.registration-form') && acceptTermsCondition() && validAddress() && validateEmail() && matchPassword();
if (validForm) {
$.ajax({
type: 'POST',
url: formURL,
@marcoslebron
marcoslebron / bootstrap_glyphs_in_rails.md
Created January 31, 2018 16:06 — forked from iamatypeofwalrus/bootstrap_glyphs_in_rails.md
Get Glyphicons up and running in Rails 3.2 without using a gem

Getting Glyphicons from Bootstrap 3.0 in Rails: the easy way

What

Bootstrap 3.0 gives you access to the awesome icon set icon set by these dudes but it's not obvious for a Rails newbie like myself to get it all working together nicely

How

  1. Download the bootstrap-glyphicons.css from here. Save that file to RAILS_ROOT/vendor/assets/stylesheet/bootstrap-glyphicons.css
  2. Save all the font files in /dist/fonts from the Bootstrap 3.0 download to a new folder in your Rails app RAILS_ROOT/vendor/assets/fonts
  3. Add this folder to the asset pipeline by appending config.assets.paths << Rails.root.join("vendor","assets", "fonts") to application.rb after the line that has class Application < Rails::Application.
  4. In bootstrap-glyphicons.css modify the the `url
@marcoslebron
marcoslebron / generate_qrcode.rb
Created January 7, 2018 15:39
How to generate qrcodes, using the rqrcode gem
- qr = RQRCode::QRCode.new(current_user.provisioning_uri("#{Platform.to_s} #{current_user.email}"), size: 8, level: :h)
table.qr
- qr.modules.each_index do |x|
tr
- qr.modules.each_index do |y|
- if qr.dark?(x,y)
td.black
- else
td.white
@marcoslebron
marcoslebron / 1 Gist conventions
Created December 1, 2017 04:17 — forked from PavloBezpalov/1 Gist conventions
Deploy Rails 5.0.0.beta3 to VPS(Ubuntu 14.04.4 LTS). Nginx, Puma, Capistrano3, PostgreSQL, RVM.
<<APP>> change this variables
======= Prolbem =================================================================================================================
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute:
rake db:create , command I get:
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'.......
bin/rake:16:in `load'
@marcoslebron
marcoslebron / rails_bootstrap_delete_confirmation_modal.md
Created August 2, 2017 14:22 — forked from postpostmodern/rails_bootstrap_delete_confirmation_modal.md
A nice delete confirmation modal in Rails courtesy of Bootstrap

Here's what you get.

Some CoffeeScript (verbosely commented for clarity)

# Override Rails handling of confirmation

$.rails.allowAction = (element) ->
  # The message is something like "Are you sure?"
  message = element.data('confirm')