Skip to content

Instantly share code, notes, and snippets.

View ziadoz's full-sized avatar

Jamie York ziadoz

View GitHub Profile
function whichTransitionEvent(){
var t;
var el = document.createElement('fakeelement');
var transitions = {
'transition':'transitionend',
'MSTransition':'msTransitionEnd',
'MozTransition':'transitionend',
'WebkitTransition':'webkitTransitionEnd'
}
@nojacko
nojacko / Testing PHP Random Salt Generation
Last active December 10, 2015 11:38
Testing PHP Random Salt Generataion
# Testing PHP Random Salt Generation
## Functions for generating salt
### mt_rand()
```
function mtSalt ($length = 22)
{
mt_srand();
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./';
$salt = '';
@mattattui
mattattui / deploy.sh
Created January 5, 2013 09:48
Simple default-safe rsync deployment script
#!/bin/bash
# Will add --dry-run unless the --go option is set. All other arguments passed to rsync (e.g. --delete)
SOURCE=.
DEST=example.com:/var/www/mysite
DRYRUN="--dry-run"
args=()
for var in "$@"
@igorw
igorw / gist:4475804
Last active October 4, 2019 15:32
Composer Versioning
@mtdowling
mtdowling / gist:4516558
Last active March 7, 2018 00:56
Fibonacci in PHP using anonymous functions and memoization
<?php
$fibMemo = call_user_func(function () {
$memo = array(0 => 0, 1 => 1);
$fib = function ($n) use (&$memo, &$fib) {
if (!isset($memo[$n])) {
$memo[$n] = $fib($n - 1) + $fib($n - 2);
}
return $memo[$n];
};
@igorw
igorw / FooController.php
Last active December 11, 2015 01:38
Convention-based Reflection Controller Provider for Silex.
<?php
// src/Igorw/FooController.php
namespace Igorw;
class FooController
{
function getIndexAction()
{
#!/usr/bin/env bash
#
# Wraps curl with a custom-drawn progress bar. Use it just like curl:
#
# $ curl-progress -O http://example.com/file.tar.gz
# $ curl-progress http://example.com/file.tar.gz > file.tar.gz
#
# All arguments to the program are passed directly to curl. Define your
# custom progress bar in the `print_progress` function.
#
@bf4
bf4 / ruby_learning.md
Last active July 17, 2021 08:06
Some Ruby Learning Resources
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.