Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Andy Feliciotti someguy9

🏠
Working from home
View GitHub Profile
@Thibaut-B
Thibaut-B / main.js
Created Oct 7, 2015
Find the closest location
View main.js
var cities = [
{
name: 'berlin',
latitude: '52.5167',
longitude: '13.3833',
},
{
name: 'athena',
latitude: '37.9667',
longitude: '23.7167',
@indragiek
indragiek / RandomNumbers.swift
Last active Nov 26, 2015
Random number generator in Swift
View RandomNumbers.swift
public struct RandomNumberGenerator: SequenceType {
let range: Range<Int>
let count: Int
public init(range: Range<Int>, count: Int) {
self.range = range
self.count = count
}
public func generate() -> GeneratorOf<Int> {
View empty-wp-plugin.php
<?php
/**
* Plugin Name: Name Of The Plugin
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: A brief description of the Plugin.
* Version: The Plugin's Version Number, e.g.: 1.0
* Author: Name Of The Plugin Author
* Author URI: http://URI_Of_The_Plugin_Author
* License: A "Slug" license name e.g. GPL2
*/
@krmd
krmd / gist:a66896838b23f0712cea
Created May 30, 2014
Gravity Forms: Exclude field from notification
View gist:a66896838b23f0712cea
//to exclude a field from notifications assign the field the CSS Class Name gf_exclude and then use the {all_fields:exclude} merge tag
add_filter( 'gform_merge_tag_filter', 'exclude_from_all_fields', 10, 4 );
function exclude_from_all_fields( $value, $merge_tag, $options, $field ) {
$options_array = explode( ",", $options ); //breaks options into an array
$exclude = in_array( "exclude", $options_array ); //returns TRUE if 'exclude' is found in the array
$class_array = explode( " ", $field["cssClass"] ); //breaks the fields CSS classes into an array
$exclude_class = in_array( "gf_exclude", $class_array ); //returns TRUE if 'gf_exclude' is found in the array
if ( $merge_tag == "all_fields" && $exclude == true && $exclude_class == true )
return false;
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active Jul 6, 2020
CriticalCSS Bookmarklet and Devtool Snippet.js
View criticalcss-bookmarklet-devtool-snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@Abban
Abban / WordPress Theme Customizer Sample.php
Created Jun 21, 2012
WordPress Theme Customizer Sample
View WordPress Theme Customizer Sample.php
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
You can’t perform that action at this time.