Skip to content

Instantly share code, notes, and snippets.

View khamer's full-sized avatar

Kevin Hamer khamer

View GitHub Profile
@khamer
khamer / isItScrollableWithoutVisibleScrollbars.js
Created July 22, 2011 19:04 — forked from jeffturcotte/isItScrollableWithoutVisibleScrollbars.js
a function to check if a certain element is scrollable, but is NOT showing scrollbars. Useful to use as a test for when you might want to implement another scrolling solution, such as iScroll for iPad.
function isItScrollableWithoutVisibleScrollbars(e) {return e&&(e.scrollHeight>e.offsetHeight)&&!(e.offsetWidth>e.scrollWidth);}
<!-- do you like this -->
<body>
<div id="foobar">
<header></header>
<div class="torso">
...
</div>
<footer></footer>
</div>
@khamer
khamer / SassMeister-input.scss
Created November 29, 2013 16:34
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
@mixin for-tablets-and-up {
@media only screen and (min-width: 600px) {
@content;
}
@khamer
khamer / SassMeister-input-HTML.html
Created March 7, 2014 16:16
Generated by SassMeister.com.
<div></div>
@khamer
khamer / SassMeister-input-HTML.html
Created March 24, 2014 19:10
Generated by SassMeister.com.
<p>
Lorem Ipsum.
</p>
hamburgers.txt
Seventeen State Street
Five Guys
The Port Tavern
Lexi's
Loretta's
Port City
░█▀█░█▀█░█▀▄░▀█▀░░░▀█▀░█▀█░█░█░█▀▀░█▀▄░█▀█ BURGERS: 0
░█▀▀░█░█░█▀▄░░█░░░░░█░░█▀█░▀▄▀░█▀▀░█▀▄░█░█
░▀░░░▀▀▀░▀░▀░░▀░░░░░▀░░▀░▀░░▀░░▀▀▀░▀░▀░▀░▀ FRIES: 0
░█░░░█▀▀░█░█░▀█▀ BURGERS: 0
░█░░░█▀▀░▄▀▄░░█░
░▀▀▀░▀▀▀░▀░▀░▀▀▀ FRIES: 0
@khamer
khamer / ExampleDatabase.php
Last active August 29, 2015 14:05
Example of a Static Class
<?php
class ExampleDatabase {
static private $db = null;
static public function connect($connection_string)
{
return self::$db = pg_connect($connection_string);
}
@khamer
khamer / ExampleDatabase.php
Last active August 8, 2022 09:41
Example of a Singleton Class
<?php
class ExampleDatabase {
static private $instance = null;
static public function getInstance()
{
if (self::$instance === null) {
self::$instance = new self();
@khamer
khamer / ExampleDatabase.php
Last active August 29, 2015 14:05
Example using Dependency Injection
<?php
class ExampleDatabase {
private $db = null;
public function __construct($connection_string)
{
$this->db = pg_connect($connection_string);
}