Skip to content

Instantly share code, notes, and snippets.

View lrdiv's full-sized avatar

Lawrence Davis lrdiv

View GitHub Profile
@lrdiv
lrdiv / gist:4613550
Last active December 11, 2015 14:19
For IE9, 8, 7, 6 check user's version of Flash Player. If it's less than 11.5, use static image for background and show div prompting them to upgrade.
var bgImageInit = function(mobile) {
var bg_image = "#{image_path('application/mobile-splash-bg.jpg')}";
$('#main-container').css('background', 'url(' + bg_image + ') right top no-repeat');
if (mobile == true) {
$('#main-container').css('background-size', '70%');
}
}
var mobileInit = function() {
var BV = new $.BigVideo({forceAutoplay:is_touch});
upstream gitlab {
server 192.168.254.37:80;
}
server {
listen 0.0.0.0:80;
server_name gitlab.kohsrv.net;
location / {
proxy_set_header X-Real-IP $remote_addr
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@lrdiv
lrdiv / default_hooks.php
Created September 17, 2013 00:18
default_hooks.php
<?php
// This function include screen.css in wp_head() function
function enqueue_stylesheets() {
wp_register_style("screen", stylesheet_url("screen"), false, false);
wp_enqueue_style("screen");
}
add_action('wp_enqueue_scripts', 'enqueue_stylesheets');
@lrdiv
lrdiv / custom-field-image-by-id
Created November 14, 2013 20:28
Pull specific image size from custom field by image ID
<?php
$attachment_id = the_field('the_image');
$size = 'small';
$image = wp_get_attachment_image_src($attachment_id, $size);
?>
<img src="<?php echo $image[0]; ?>" />
@lrdiv
lrdiv / third-grade-homework.js
Last active August 29, 2015 14:00
A Twitter friend mentioned that her 3rd grade daughter had some tough math homework. Tried to solve it with JS.
var firstClue = function(min, max, digitSum) {
for(var i = min; i < max; i++) {
var digitArray = i.toString().split('');
var digitTotal = 0;
digitArray.forEach(function(digit) {
digitTotal += parseInt(digit);
});
if ( digitTotal < digitSum ) {
return i;
@lrdiv
lrdiv / international_states.cson
Last active August 29, 2015 14:03
JSON object for states in US, AU, CA, GB, MX
states: [
{
country: "US"
states: [
{
name: "Alabama"
abbreviation: "AL"
}
{
name: "Alaska"
@lrdiv
lrdiv / international_states.js
Created June 25, 2014 22:20
JSON object for states in US, AU, CA, GB, MX
({
states: [
{
country: "US",
states: [
{
name: "Alabama",
abbreviation: "AL"
}, {
name: "Alaska",
@lrdiv
lrdiv / chosen_view.coffee
Last active August 29, 2015 14:03
Chosen.js Ember.Select pattern
ChosenView = Ember.Select.extend
didInsertElement: ->
@_super
options =
multiple: false
search_contains: true
options.clean_search_text = this.cleanSearchText
options.calling_context = this
@lrdiv
lrdiv / Brocfile.js
Created July 7, 2014 23:04
Disable ember-cli asset fingerprinting in development
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp({
minifyCSS: {
enabled: true,
options: {}
},
@lrdiv
lrdiv / keybase.md
Created January 14, 2015 16:35
Proving myself on keybase...

Keybase proof

I hereby claim:

  • I am lrdiv on github.
  • I am lrdiv (https://keybase.io/lrdiv) on keybase.
  • I have a public key whose fingerprint is 0742 B5C9 AA02 256B 950A A213 A26B 312C CA2E A84F

To claim this, I am signing this object: