Skip to content

Instantly share code, notes, and snippets.

Jamie York ziadoz

Block or report user

Report or block ziadoz

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
@ziadoz
ziadoz / awesome-php.md
Last active Jun 2, 2019
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
View awesome-php.md
@ziadoz
ziadoz / example.js
Created Feb 23, 2012 — forked from anonymous/example.js
JQuery Resize Events
View example.js
// See: http://ejohn.org/blog/learning-from-twitter/
(function($) {
$(document).ready(function() {
var resizeCallable = function() {
switch (true)
{
case (window.innerWidth <= 768):
// Do some exciting device size specific magic here.
break;
}
@ziadoz
ziadoz / meta.php
Created Feb 29, 2012 — forked from funkatron/foo.php
PHP 5.4 Meta Programming?
View meta.php
<?php
// See: https://gist.github.com/1942528
trait Call_Dynamic_Methods
{
public function __call($name, $arguments)
{
if (isset($this->{$name}) && $this->{$name} instanceof Closure) {
$this->{$name} = $this->{$name}->bindTo($this, $this);
return call_user_func_array($this->{$name}, $arguments);
}
@ziadoz
ziadoz / number.php
Created Mar 20, 2012
PHP CLI Skeleton
View number.php
#!/usr/bin/env php
<?php
function main($argv) {
$opts = getopt(null, array('min:', 'max:'));
$min = (int) isset($opts['min']) ? trim($opts['min']) : 0;
$max = (int) isset($opts['max']) ? trim($opts['max']) : 100;
puts("Guess The Number \n", 'green');
puts("I'm thinking of a number between $min and $max \n\n");
@ziadoz
ziadoz / number.py
Created Mar 23, 2012
Python CLI Skeleton
View number.py
#!/usr/bin/env python
import optparse, random, sys
def main():
parser = optparse.OptionParser()
parser.add_option('--min', type="int", default=0, help="The minimum number limit.")
parser.add_option('--max', type="int", default=100, help="The maximum number limit.")
opts, args = parser.parse_args()
tries = 0
@ziadoz
ziadoz / textarea-auto-height.js
Created Mar 29, 2012
jQuery TextArea Auto Height
View textarea-auto-height.js
$('textarea.notes').on('focus blur keyup', function() {
var paddingTop = $(this).css('padding-top').replace('px', ''),
paddingBottom = $(this).css('padding-bottom').replace('px', '');
$(this).css('height', '1px');
$(this).css('height', (this.scrollHeight - paddingTop - paddingBottom) + 'px');
}).blur();
@ziadoz
ziadoz / config.yml
Created Jun 18, 2012
Rails 3 YAML Configuration Loader
View config.yml
# config/config.yml
defaults: &defaults
key: value
regexp: !ruby/regexp /pattern/
development:
<<: *defaults
test:
@ziadoz
ziadoz / application_helper.rb
Created Jun 18, 2012
Rails 3 Page Title Breadcrumb
View application_helper.rb
module ApplicationHelper
def build_page_title(*crumbs)
crumbs.map(&:to_s).reject(&:empty?).join(' - ')
end
end
@ziadoz
ziadoz / debounce-keyup.js
Created Jul 5, 2012
jQuery Debounce Key Up
View debounce-keyup.js
// Throttle / Debounce Plugin: http://benalman.com/projects/jquery-throttle-debounce-plugin/
$(document).ready(function() {
var callback = function(event) {
event.preventDefault();
// Do exciting things here.
};
$('form.search').on({
submit: callback,
@ziadoz
ziadoz / jquery-ios-safari-fullscreen-links.js
Created Jul 9, 2012
jQuery iOS Safari Fullscreen Links
View jquery-ios-safari-fullscreen-links.js
You can’t perform that action at this time.