Skip to content

Instantly share code, notes, and snippets.

@akuzemchak
akuzemchak / gist:842685
Created Feb 24, 2011
Only apply ToggleVal to empty inputs
View gist:842685
var $input = $('#my-input');
if(!$input.val()) {
$input.toggleVal({
populateFrom: 'custom',
text: 'Default value'
});
}
@akuzemchak
akuzemchak / Side Bar.sublime-menu
Created Aug 13, 2011
Delete non-empty folder in Sublime Text 2
View Side Bar.sublime-menu
# add this to the main command array...
{ "caption": "Delete Folder and Contents", "command": "delete_folder_recursive", "args": {"dirs": []} }
@akuzemchak
akuzemchak / Side Bar.sublime-menu
Created Aug 13, 2011
Reveal folder in Finder for Sublime Text 2
View Side Bar.sublime-menu
# add this to the main command array...
{ "caption": "Open Containing Folder…", "command": "open_this_folder", "args": {"dirs": []} }
View auth.php
<?php
class Auth extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->spark('yall/0.2.0'); // not needed if autoloaded
}
@akuzemchak
akuzemchak / examples.php
Created Jun 13, 2012
PHP string formatting function
View examples.php
<?php
include 'str_format.php';
// example 1
echo str_format(':foo + :bar = :baz', array(
'foo' => 5,
'bar' => 6,
'baz' => 11,
));
@akuzemchak
akuzemchak / Default (OSX).sublime-keymap
Last active Oct 9, 2015
Sublime Text 2 Preferences
View Default (OSX).sublime-keymap
[
{ "keys": ["super+alt+left"], "command": "prev_view_in_stack" },
{ "keys": ["super+alt+right"], "command": "next_view_in_stack" },
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }
]
@akuzemchak
akuzemchak / l4project.sh
Last active Dec 6, 2020
New L4 project with clean history
View l4project.sh
# Initial setup
git clone -o framework -b develop https://github.com/laravel/laravel.git project-name
cd project-name
git checkout --orphan master
git commit -m "Initial commit"
# Pulling changes
git fetch framework
git merge --squash -m "Upgrade Laravel" framework/develop
# Fix merge conflicts if any and commit
@akuzemchak
akuzemchak / DeployCommand.php
Created Jul 8, 2013
Basic Laravel deployment script
View DeployCommand.php
<?php
// app/commands/DeployCommand.php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class DeployCommand extends Command
{
@akuzemchak
akuzemchak / FeatureContext.php
Created Mar 7, 2014
Take screenshot of failed Behat step
View FeatureContext.php
<?php
use Behat\Behat\Event\StepEvent;
use Behat\Behat\Event\SuiteEvent;
use Behat\MinkExtension\Context\MinkContext;
class FeatureContext extends MinkContext
{
/**
* @AfterStep