Skip to content

Instantly share code, notes, and snippets.

Junio Vitorino juniovitorino

Block or report user

Report or block juniovitorino

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jeangontijo
jeangontijo / is_in_viewport.js
Created Jun 14, 2018
Change the class when the element is visible in the viewport
View is_in_viewport.js
var visible = document.querySelectorAll('.element');
function isInViewport(el) {
var rect = el.getBoundingClientRect();
return (
// when any part of element is visible
rect.top >= -el.clientHeight &&
rect.left >= -el.clientWidth &&
rect.bottom <= window.innerHeight + el.clientHeight &&
rect.right <= window.innerWidth + el.clientWidth
@danwit
danwit / passport_node_acl_example.js
Created May 1, 2014
Authentication and authorization with passportjs + node_acl + mongo + express
View passport_node_acl_example.js
/**
* Simple authentication and authorization example with passport, node_acl,
* MongoDB and expressjs
*
* The example shown here uses local userdata and sessions to remember a
* logged in user. Roles are persistent all the way and applied to user
* after logging in.
*
* Usage:
* 1. Start this as server
@scottnix
scottnix / gist:10430003
Last active Aug 14, 2016
Gulpfile.js Sample, latest
View gist:10430003
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
rename = require('gulp-rename'),
notify = require('gulp-notify'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
markdown = require('gulp-markdown'),
@macdonst
macdonst / sqltest.js
Created Dec 21, 2011
Create DB from .sql file
View sqltest.js
if (localStorage.getItem("dbCreated") != true) {
html5sql.openDatabase("ScratchDB", "Scratch DB", 3 * 1024 * 1024);
var request = new XMLHttpRequest();
request.open("GET", "file:///android_asset/www/create.sql", true);
request.onreadystatechange = function(){
if (request.readyState == 4) {
if (request.status == 200 || request.status == 0) {
html5sql.process(request.responseText,
function(){
console.log("Win!");
@cballou
cballou / wordpress-multi-env-configphp-setup.php
Created Aug 15, 2011
Wordpress Multi-Environment wp-config.php Setup
View wordpress-multi-env-configphp-setup.php
<?php
/**
* This code is intended to be added to your wp-config.php file just below the top comment block.
* It should replace the existing define('DB_*') statements. You can add or remove sections
* depending on the number of environments you intend to setup. You should change all values of
* DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST for each environment, making them all distinct
* for security purposes.
*/
// determine the current environment
@jphpsf
jphpsf / application.html.erb
Created Jul 16, 2011
Reuse of the Rails Admin layout for the whole application
View application.html.erb
# app/views/layouts/application.html.erb
<% head_style 'styles' %>
<% head_javascript 'application' %>
<%= render :file => 'layouts/rails_admin/main' %>
View gist:957755
filenames = Dir.glob(Rails.application.paths.app.models.collect { |path| File.join(path, "**/*.rb") })
$class_names = []
filenames.each do |filename|
$class_names += File.read(filename).scan(/class ([\w\d_\-:]+)/).flatten
end
@rafaelsachetto
rafaelsachetto / gist:758655
Created Dec 29, 2010
Dica para ambiente usando RVM (pushd/popd)
View gist:758655
# hack to rvm invoke .rvmrc
cd_with_pushd()
{
if [ $# -eq 0 ]; then
DIR="${HOME}"
else
DIR="$1"
fi
pushd "${DIR}"
@ghickman
ghickman / _contact.rb
Created Jul 4, 2010
Jekyll Contact Form with Sinatra
View _contact.rb
require 'rubygems'
require 'sinatra'
require 'pony'
require 'haml'
set :haml, {:format => :html5}
set :public, File.dirname(__FILE__)
set :views, File.dirname(__FILE__)
# Create the page class and give it a title of Contact for the layout
@mrrooijen
mrrooijen / carrierwave_tasks.rb
Created Jun 2, 2010
Rake Tasks for Carrier Wave for reprocessing versions.
View carrierwave_tasks.rb
##
# CarrierWave Amazon S3 File Reprocessor Rake Task
#
# Written (specifically) for:
# - CarrierWave
# - Ruby on Rails 3
# - Amazon S3
#
# Works with:
# - Any server of which you have write-permissions in the Rails.root/tmp directory
You can’t perform that action at this time.