Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Burnette ryanburnette

View GitHub Profile
@ryanburnette
ryanburnette / header.html
Last active Aug 29, 2015
Two versions of jQuery in a restrictive situation.
View header.html
<!-- At this point our environmental jQuery should have already loaded, we'll
assign it to a separate variable on the window and delete the dollar sign -->
<script>
window.jQuery142 = window.jQuery;
delete window.$;
</script>
<!-- Next, we'll load our next version of jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
View _syntax.sass
// Jekyll Pygments syntax highlighter styles
// Colors
$default: #FFFFFF
$background: #010101
$comment: #586E75
$error: #586E75
$generic: #93A1A1
$keyword: #859900
$literal: #93A1A1
View Gruntfile.js
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json')
, coffeelint: {
app: ['./assets/javascripts/**/*.coffee']
}
View facebook_fetch_share_count.rb
require 'net/http'
require 'uri'
require 'json'
class FacebookFetchShareCount
attr_accessor :uri
attr_reader :shares
def initialize(uri)
@uri = uri
View get_with_params.rb
# http://stackoverflow.com/a/1252305/2535178
def get_with_params(domain,path,params)
res = Net::HTTP.get(domain, "#{path}?".concat(params.collect { |k,v| "#{k}=#{CGI::escape(v.to_s)}" }.join('&'))) if not params.nil?
end
View Vagrantfile
hostname = "vagrant"
project = "project"
box = "ubuntu/trusty64"
cpus = `sysctl -n hw.ncpu`.to_i
memory = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
recipes = %w{essentials permissions}
Vagrant.configure(2) do |config|
config.vm.box = box
config.vm.hostname = hostname
@ryanburnette
ryanburnette / gf_action.php
Created May 3, 2014
Add additional actions to a Gravity Forms submission in WordPress.
View gf_action.php
<?php
function do_something_else($entry, $form) {
// Gravity Forms has validated the data
// Our Custom Form Submitted via PHP will go here
}
add_action("gform_post_submission", "do_something_else", 10, 2);
View slugify.rb
def slugify(text)
text.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
end
View call_async.js
(function () {
var e
, s
, src = '//example.com/example.js'
;
e = document.createElement('script');
e.async = true;
e.type='text/javascript';
e.src = src;
You can’t perform that action at this time.