Skip to content

Instantly share code, notes, and snippets.

View msurguy's full-sized avatar

Maksim Surguy msurguy

View GitHub Profile
@msurguy
msurguy / message.php
Created August 20, 2012 19:37
laravel Message library
<?php
class Msg {
public static $msgss = array();
/**
* Add a message to the message array (adds to the user's session)
* @param string $type You can have several types of messages, these are class names for Bootstrap's messaging classes, usually, info, error, success, warning
* @param string $message The message you want to add to the list
*/
public static function add($type = 'info', $message = FALSE){
@msurguy
msurguy / gist:3515621
Created August 29, 2012 16:59 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@msurguy
msurguy / Tokenahead.less
Created September 5, 2012 20:06 — forked from fat/Tokenahead.less
Tokenahead - ghetto typeahead with facebook-like tokens 4 @couch <3
// Tokenahead.less
// ---------------
.tokenahead {
cursor: text;
overflow: hidden;
height: auto;
padding-bottom: 0;
border-color: @inputBorder;
}
@msurguy
msurguy / README.markdown
Created September 5, 2012 20:25 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@msurguy
msurguy / snippet.xml
Created September 16, 2012 04:16 — forked from JeffreyWay/snippet.xml
Laravel Resource - Sublime Text 2 Snippet
<snippet>
<content><![CDATA[
// ${1} Resource
Route::get('${1}s', array('as' => '${1}s', 'uses' => '${1}s@index'));
Route::get('${1}s/(:any)', array('as' => '${1}', 'uses' => '${1}s@show'));
Route::get('${1}s/new', array('as' => 'new_${1}', 'uses' => '${1}s@new'));
Route::get('${1}s/(:any)edit', array('as' => 'edit_${1}', 'uses' => '${1}s@edit'));
Route::post('${1}s', '${1}s@create');
Route::put('${1}s/(:any)', '${1}s@update');
Route::delete('${1}s/(:any)', '${1}s@destroy');
@msurguy
msurguy / custom.js
Created September 22, 2012 00:36 — forked from drewjoh/custom.js
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.1)
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {
@msurguy
msurguy / custom.js
Created September 22, 2012 00:36 — forked from nextroy/custom.js
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.0) : Fix for removing the response Modal content
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').bind('click',function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$('#response_modal').modal('open');
} else {
@msurguy
msurguy / awesome-php.md
Created September 27, 2012 00:59 — forked from ziadoz/awesome-php.md
Awesome PHP Libraries

Awesome PHP Libraries

A list of amazingly awesome PHP libraries that you should be using:

@msurguy
msurguy / auth.php
Created September 28, 2012 21:03 — forked from mwesten/auth.php
Laravel 3 Auth Controller
<?php
class Auth_Controller extends Base_Controller {
public $restful = true;
public function __construct() {
$this->filter( 'before', 'guest' )->except( array( 'logout', 'validate' ) );
// Note: We may not always require CSRF on login for system based logins so ignore it here.
$this->filter( 'before', 'csrf' )->on( 'post' )->except( array( 'login' ) );
}
@msurguy
msurguy / gist_line_numbers.css
Created October 18, 2012 18:36 — forked from potch/gist_line_numbers.css
CSS to add line numbers to embedded gists
.gist-highlight {
border-left: 3ex solid #eee;
position: relative;
}
.gist-highlight pre {
counter-reset: linenumbers;
}
.gist-highlight pre div:before {