Skip to content

Instantly share code, notes, and snippets.

View jrmadsen67's full-sized avatar
💭
Looking for new remote opportunities

Jeff Madsen jrmadsen67

💭
Looking for new remote opportunities
View GitHub Profile
@jrmadsen67
jrmadsen67 / gist:605c29e17822e53ebf94
Created July 5, 2014 23:22
Decouple Twitter Bootstrap from your html
"Just make it with Boostrap & we'll put something better behind it later"
How many times have you heard that? Then "later" - if it comes - means going through all of your layouts and views and changing all class names. Of course it's possible that your designer will reuse css framework class names for you, but unlikely and not at all if they are just switching to a different css framework. What to do?
My thought is - aliasing. I've always felt (as have others, I've seen) that css frameworks really "do things wrong" in how they force you to tightly couple your elements to their framework. It really defeats the purpose of a separate stylesheet to begin with. So, playing around a little I came up with this experiment. I'm not a designer first - my focus is on the backend stuff - so I'd really appreciate any feedback on the idea. Is this actually practicable? Does it stir the juices and give you a better idea? Please let me know!
------
I'm using Sass, but I'm sure you can do something similar with LESS.
@jrmadsen67
jrmadsen67 / called.in wrapper for Codeigniter
Created March 10, 2012 08:54
called.in wrapper for Codeigniter
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Calledin{
private $ci;
private $messages = array(
0=>'Success',
1=>'invalid api_key',
2=>'no call credits',
@jrmadsen67
jrmadsen67 / multi-checkbox in list
Created November 5, 2012 23:21
simple div with multi-list checkboxes
<style>
.scroll_checkbox {
border: 1px solid #CCCCCC;
height: 200px;
overflow: auto;
padding: 5px;
width: 250px;
}
</style>
@jrmadsen67
jrmadsen67 / gist:4052790
Created November 10, 2012 22:35
example of map_array() with "use" to pass in variable
function map_array()
{
$names = array('Foo', 'Bar', 'Baz', 'Buzz');
$tweeps = array();
foreach ($names as $name) {
$tmp = new StdClass;
$tmp->name = $name;
$tmp->age = rand(2,7);
@jrmadsen67
jrmadsen67 / gist:4054208
Created November 11, 2012 08:56
php - create days of week array from functions
$date = new DateTime('first Sunday');
$weeksdays_array = array_map(function($val) use ($date) {return $date->add(new DateInterval('P'.$val.'D'))->format('l');}, range(0,6));
var_dump($weeksdays_array);
@jrmadsen67
jrmadsen67 / gist:4274093
Created December 13, 2012 04:50
git cleanup script. sets all deleted files to git rm <file>
for i in `git status |grep deleted |awk '{print $3}'` ; do git rm $i; done
@jrmadsen67
jrmadsen67 / CI dynamic dropdown
Created January 5, 2013 08:00
A CodeIgniter dynamic dropdown to allow common languages to appear both at the top of the list and in order
function full_languages_dropdown($id='' )
{
$ci = &get_instance();
$ci->load->model('language_model');
$common_languages = $ci->language_model->order_by('language', 'asc')->get_many_by(array('common'=>1));
$languages = $ci->language_model->order_by('language', 'asc')->dropdown('id', 'language');
$html = '<select id="'.$id.'" name="'.$id.'">';
@jrmadsen67
jrmadsen67 / gist:4618291
Last active December 11, 2015 14:59
jquery function to move focus to next element of group when max length hit. for use with phone numbers, dates, etc
// assumes you set tabIndex="0" ... last element in group
// set all elements in group with same class
// set each element with max length
// obviously, "phones" is not generic, easy to switch. Code I just wrote for something quick; will fix that later
$('.phone').keyup(function(){
jumpNext($(this), $(this).val())
});
@jrmadsen67
jrmadsen67 / gist:4695757
Created February 2, 2013 02:18
Playing around with callbacks in array_map. Notice array($this, 'process') lets you specify an object->method, perfect for use in framework controller (like in Codeigniter)
<?php
$main_object = new main_object();
$main_object->main();
class main_object{
function main()
{
@jrmadsen67
jrmadsen67 / gist:5028002
Last active December 14, 2015 04:28
Takes data from a key:value table & combines it onto a single-row record, per item
/*
Data starts in table:
ProjectId, key, value
1 totaltime 02:34:56
1 zip.url http://www.mysite.com/download/file.zip
1 zip.size 12MB