Skip to content

Instantly share code, notes, and snippets.

Brennan Novak bnvk

Block or report user

Report or block bnvk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:245797
<div id="lightbox" style="display: none">
<div id="lightbox-header"><img src="../images/lightbox_header.jpg" border="0" /></div>
<div class="authorize">
<div class="facebook-column">
Share on Facebook
<%= fb_connect_javascript_tag %>
<%= init_fb_connect "XFBML"%>
<% js = update_page {|page| page.redirect_to fb_status_path}%>
<%= fb_login_button js%>
View CodeIgniter .htaccess
.htaccess for CodeIgniter allows folders in the root folder such as css js images, etc
Options +FollowSymLinks
RewriteEngine On
RewriteCond $1 !^(index\.php|favicon\.ico|css|js|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
View CodeIgniter Config
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
| Base Site URL
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
View gist:345184
echo implode($geo_data); StatesOregonPortland45.5184-122.655-8-8-7
echo print_r($geo_data);
Array ( [ip] => [country_code] =>
SimpleXMLElement Object ( [0] => US ) [country_name] =>
View CodeIgniter Geo Location by IP
if (!function_exists('get_geolocation')) {
function get_geolocation($ip) {
$d = file_get_contents("$ip&output=xml");
//Use backup server if cannot make a connection
if (!$d) {
$backup = file_get_contents("$ip&output=xml");
$result = new SimpleXMLElement($backup);
if (!$backup)
View Confusing array
$home_base_array = array('0' => '--select--', $this->config->item('site_name') => $this->config->item('site_name'));
foreach($this->config->item('social_connections') as $connection) :
$home_base_array[] = array($connection => $connection);
View gist:374364
$('.vote_up').live('click', function(eve) {
var request = $(this).attr('id');
$.get('http://localhost:8888/'+request, function(html) {
if(parseFloat(html)) {
$('#vote_'+request).html('+'+html+'<img src=\"http://localhost:8888/\" border\"0\" />');
View PHP include() displaying number 1 after print
I just encountered a weird little quirk of PHP that I spent awhile trying to resolve, so I'm posting this as a Google search turns up nothing.
When including a .php file in the midst of an html/view file using the include() function:
<?= include('myfile.php') ?>
Was producing a number '1' located after the end of include. The issue turns out to be a bug / feature or using short tags:
View SendGrid App Filter Borken!
// Creates Object & arrays
$hdr = new SmtpApiHeader();
$toList = array();
$nameList = array();
$pubkeyList = array();
$BurstCount = 0;
// Loop Que
do {
bnvk / JavascriptDateFunctions.js
Created Jan 11, 2011
Some simple, yet useful JS date/time functions
View JavascriptDateFunctions.js
// Gets Current Browser Date/Time
var now = new Date();
// Gets Current Browser Timezone
var zone = now.toString().substr(25,6) + ":" + now.toString().substr(31,2);
You can’t perform that action at this time.