Skip to content

Instantly share code, notes, and snippets.

View jrobinsonc's full-sized avatar
🎯
Focusing

Jose Robinson jrobinsonc

🎯
Focusing
View GitHub Profile
@jrobinsonc
jrobinsonc / angularjs-directive-bootstrap-pagination.js
Last active April 7, 2016 01:49
Angular directive: pagination with bootstrap.
angular.module("app.directives", [])
.directive("pagination", function($location){
return {
restrict: 'A',
link: function($scope, element, attrs) {
function getInt (val){
return parseInt(String(val).replace(/[^0-9]+/, ''));
}
@jrobinsonc
jrobinsonc / README.md
Last active May 7, 2016 16:33
WP_Widget_Ex: An easy way to create widgets in WordPress.

WP_Widget_Ex

An easy way to create widgets in WordPress

Usage

First: Require the WP_Widget_Ex class.

require_once get_template_directory() . '/inc/wp_widget_ex.php';
@jrobinsonc
jrobinsonc / ul.scss
Last active February 5, 2018 00:05
Custom style for <ul> tag.
ul {
list-style: none;
padding: 0;
margin: 0 0 0 20px;
li {
padding-left: 1em;
text-indent: -1.8em;
margin-bottom: 10px;
<?php
/**
* Embed SoundCloud.
*
* @param string $url The URL of the audio in SoundCloud.
* @return string Returns the IFRAME tag.
*/
function embed_soundcloud($url)
{
@jrobinsonc
jrobinsonc / youtube-thumbnails.md
Created May 23, 2016 12:29
Youtube thumbnails

Youtube thumbnails

Each YouTube video has 4 generated images. They are predictably formatted as follows:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
@jrobinsonc
jrobinsonc / Gruntfile.js
Last active November 12, 2016 02:17
Gruntfile configurations
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
});
grunt.registerTask('default', []);
// grunt.registerTask('install', ['composer:update', 'bower:install', 'sprite:s1', 'copy', 'concat', 'replace']);

PHPExcel Cheat Sheet

Documentation

Snippets

Install.

composer require phpoffice/phpexcel
@jrobinsonc
jrobinsonc / clean-value.php
Created June 2, 2016 15:35
PHP helper: clean_value
<?php
function clean_value($value, $format = '')
{
if (is_array($value))
{
foreach ($value as $k => $v)
{
$value[$k] = clean_value($v, $format);
}
@jrobinsonc
jrobinsonc / httpd-vhosts.conf
Created June 10, 2016 21:55
Virtual host for localhost
<VirtualHost *:80>
DocumentRoot "D:/webdev"
ServerName localhost
ServerAlias 127.0.0.1
<Directory "D:/webdev">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
</Directory>
@jrobinsonc
jrobinsonc / required-plugins.php
Created June 25, 2016 04:56
WordPress: Required plugins hook.
<?php
add_action('admin_notices', function()
{
$plugin_messages = array();
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$required_plugins = [
'wordpress-seo/wp-seo.php' => 'Yoast SEO',