Skip to content

Instantly share code, notes, and snippets.

View dyaa's full-sized avatar

Dyaa dyaa

View GitHub Profile
@dyaa
dyaa / FilePicker Test
Created July 26, 2013 23:52
FilePicker Test
<html>
<head>
<title>FilePicker Test Drive</title>
</head>
<body>
<input class="picker" name="myName"/>
<input type="text" class="naed" value="NONE"/>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
@dyaa
dyaa / route.php
Created August 9, 2013 15:12
Laravel 4 :route with a regex From http://paste.laravel.com/HXK
Route::get('blog/{slug}', function($slug) {
return View::make('hello');
})->where('slug', '[a-zA-Z0-9]+');

Basic Explaination

It would be nice if we had a plugin that allows Laravel to play nice with Ember. Put simply I would like to create an easy way for Laravel to output JSON strings in a way that Ember likes.

What Laravel Does

return Model::find($id);
@dyaa
dyaa / index.html
Created August 24, 2013 17:19
Easy (3D CSS card flip) example
<div class="flip">
<div class="card">
<div class="face front">
Front
</div>
<div class="face back">
Back
</div>
</div>
</div>
<?php
class Users_Controller extends Base_Controller {
public function action_index() {
$id = Input::get('id');
if ($id) {
$user = DB::table('users')->where('id', $id)->first();
jQuery(document).ready(function($) {
// Inside of this function, $() will work as an alias for jQuery()
// and other libraries also using $ will not be accessible under this shortcut
});
@dyaa
dyaa / index.html
Created September 9, 2013 21:19
Make Entire Div Clickable Looks for a link inside div with class of "myBox". Redirects to that links value when anywhere in div is clicked.
<div class="myBox">
blah blah blah.
<a href="http://google.com">link</a>
</div>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@dyaa
dyaa / ajaxerror.js
Created September 22, 2013 13:03
JQUERY AJAX ERROR HANDLING FUNCTION
$(function() {
$.ajaxSetup({
error: function(jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.\n Verify Network.');
} else if (jqXHR.status == 404) {
alert('Requested page not found. [404]');
} else if (jqXHR.status == 500) {
alert('Internal Server Error [500].');
} else if (exception === 'parsererror') {
@dyaa
dyaa / jplayer.js
Created September 30, 2013 14:38
#jplayer display the current song name in the main box
var myPlaylist = new jPlayerPlaylist({
//then this will capture the current song's title:
//myPlaylist.playlist[myPlaylist.current].title
//For instance, I used this to capture the current song's title and insert it into a div on my page with id 'current-track':
var myPlaylist = new jPlayerPlaylist({ the playlist });
$("#jquery_jplayer_1").bind($.jPlayer.event.play, function(event) {