Skip to content

Instantly share code, notes, and snippets.

View Narayon's full-sized avatar
🛠️

Rui Barbosa Narayon

🛠️
View GitHub Profile
@Narayon
Narayon / osx_bootstrap.sh
Last active September 4, 2022 21:39 — forked from codeinthehole/osx_bootstrap.sh
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Newton (app store)
@Narayon
Narayon / vagrant-scp
Last active April 8, 2018 01:53 — forked from geedew/vagrant-scp
Copying files from and to a Vagrant VM
#!/bin/sh
# Change these settings to match what you are wanting to do
FILE=/File/To/Copy
PATH=/Where/To/Put/File
OPTIONS=`vagrant ssh-config | grep -v '^Host ' | awk -v ORS=' ' 'NF{print "-o " $1 "=" $2}'`
# copy from host to vagrant
# scp ${OPTIONS} $FILE v:$PATH
@Narayon
Narayon / wp-query-ref.php
Created February 13, 2017 15:54
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference.
*
* All credits go to luetkemj. Thanks!
*
* @author luetkemj <luetkemj@gmail.com>
* @author s3rgiosan <me@s3rgiosan.com>
*
* @see http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
@Narayon
Narayon / block-scroll.css
Last active April 8, 2018 01:53 — forked from davidgilbertson/block-scroll.css
Don't resize the body when you open a modal
/* the page should not change width as content is loaded */
body {
overflow-y: scroll;
}
/* block scrolling without losing the scroll bar and shifting the page */
/* add this class when a modal is open */
body.block-scroll {
overflow: hidden;
overflow-y: scroll !important;
@Narayon
Narayon / gulpfile.js
Created August 25, 2016 10:05 — forked from jadsalhani/gulpfile.js
Ionic Tutorial
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('shelljs');
var uglify = require('gulp-uglify');
var mainBowerFiles = require('main-bower-files');
@Narayon
Narayon / analyse_watchers.js
Last active April 8, 2018 02:52 — forked from DTFagus/analyse_watchers.js
Bookmarklet to analyse angular watchers
javascript: (function() {
var root = angular.element(document.getElementsByTagName('html'));
var watchers = [];
var attributes = [];
var attributes_with_values = [];
var elements = [];
var elements_per_attr = [];
var scopes = [];
@Narayon
Narayon / gist:ecfe2abecf76debe9937
Last active April 8, 2018 02:52 — forked from jennimckinnon/functions.php
Wordpress: Add Google Font
function google_fonts() {
$query_args = array(
'family' => 'Open+Sans:400,700|Oswald:700'
'subset' => 'latin,latin-ext',
);
wp_register_style( 'google_fonts', add_query_arg( $query_args, "//fonts.googleapis.com/css" ), array(), null );
}
add_action('wp_enqueue_scripts', 'google_fonts');
@Narayon
Narayon / gist:6c56a8591c7cbb2454ab
Last active April 8, 2018 02:52 — forked from jameskoster/functions.php
WooCommerce: dequeue css (2.1+)
// Remove each style one by one
add_filter( 'woocommerce_enqueue_styles', 'jk_dequeue_styles' );
function jk_dequeue_styles( $enqueue_styles ) {
unset( $enqueue_styles['woocommerce-general'] ); // Remove the gloss
unset( $enqueue_styles['woocommerce-layout'] ); // Remove the layout
unset( $enqueue_styles['woocommerce-smallscreen'] ); // Remove the smallscreen optimisation
return $enqueue_styles;
}
// Or just remove them all in one line
@Narayon
Narayon / random.js
Last active April 8, 2018 02:52 — forked from kerimdzhanov/random.js
Javascript: random number in a specific range
// MIT License
// @return {float} a random number between min and max
function getRandom(min, max) {
return Math.random() * (max - min) + min;
}
// @return {integer} a random int between min and max
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
@Narayon
Narayon / jQuery-preloadFunction
Last active April 8, 2018 02:52 — forked from simaovergalho/jQuery-preloadFunction
jQuery: Preload Images, CSS and JS
/*!
* $.preload() function for jQuery – http://mths.be/preload
* Preload images, CSS and JavaScript files without executing them
* Script by Stoyan Stefanov – http://www.phpied.com/preload-cssjavascript-without-execution/
* Slightly rewritten by Mathias Bynens – http://mathiasbynens.be/
* Note that since this script relies on jQuery, the preloading process will not start until jQuery has finished loading.
*/
jQuery.preload = function(array) {
var length = array.length,