This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PostsTest extends TestCase { | |
public function testShow() | |
{ | |
$testpost = ['text' => 'Test post', 'id' => 1]; | |
$this->instanceMock('PostRepositoryInterface')->shouldReceive('find')->with(1)->once()->andReturn($testpost); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this would go in the base TestCase class | |
public function mockFacade($facadeName) | |
{ | |
$facadeClass = get_class(call_user_func([$facadeName, 'getFacadeRoot'])); | |
$mock = m::mock($facadeClass); | |
call_user_func([$facadeName, 'swap'], $mock); | |
return $mock; | |
} | |
//it would be invoked like this: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My setup has Cmd-S and Cmd-Shift-S remapped to run the following AFTER saving: | |
if [ $TM_RSYNC_SOURCE ] | |
then | |
rsync -e "ssh" -avz --exclude '.DS_Store' --exclude '.FBCLockFolder' --exclude 'templates_c/' --exclude 'css/compiled/' --exclude '*.git' --exclude '*.out' --exclude '*.mlog' --delete "$TM_RSYNC_SOURCE" "$TM_RSYNC_DEST" | |
fi | |
the variables are project-specific Textmate variables--I'm sure there must be a way to | |
do something similar with Sublime--I just haven't tried yet. For me, for example, | |
TM_RSYNC_DST is karp@ourdevsystem.com:/var/www/karp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DanielKarp: Hey--Sort of new to Sublime text. I'm trying to write a plugin to rsync my files to a remote server on save (I do the same thing in textmate). So far, not a lot of luck. Here is what I have so far: http://pastebin.com/Nv4QYG1N | |
[10:10pm] DanielKarp: any advice? am I going about this all wrong? | |
[10:11pm] DanielKarp: (this is a combination of what I used with textmate with some cut and paste from other people's plugins, mostly) | |
[10:19pm] aat joined the chat room. | |
[10:20pm] ggreer: if you're on linux, you can probably use inotify-tools to do that regardless what editor you're using | |
[10:20pm] ggreer: and if you're on OS X, I wrote an auto-rsync thing: https://github.com/ggreer/fsevents-tools | |
[10:20pm] ggreer: but going back to your plugin, it would be helpful if you linked to any error messages or exceptions you ran into | |
[10:26pm] aat left the chat room. (Quit: Computer has gone to sleep.) | |
[10:26pm] moo-_-: DanielKarp: http://pypi.python.org/pypi/watchdog | |
[10:27pm] ggreer: yeah, that too |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ $TM_RSYNC_SOURCE ] | |
then | |
rsync -e "ssh" -avz --exclude '.DS_Store' --exclude '.FBCLockFolder' --exclude 'scaffold/cache' --exclude 'css/compiled/' --exclude '*.git' --exclude 'app/compiled/smarty/' --exclude '*.out' --exclude '*.mlog' --delete "$TM_RSYNC_SOURCE" "$TM_RSYNC_DEST" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Intended use of Sections | |
//This is not functional code, but will give you and idea of the changes intended | |
//an ordered array of section names | |
$sections = array( 'people', 'authors' ); | |
//to store | |
Cache::sections( $sections )->put('John', $john); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Intended use of Tags | |
//an ordered array of tag names | |
$tags = array( 'people', 'authors' ); | |
//to store | |
Cache::tags( $tags )->put('John', $john); | |
//to access |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//================================================================================================= | |
class GeekCache_SimpleQuery extends GeekCache_TrackedCache | |
{ | |
//============================================================================================== | |
public function __construct( $query, $timelimit, $namespaces=array(), $filename = '' ) | |
{ | |
if ( !$filename ) | |
$filename = 'query_' . md5( $query ); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Click a delete button. Get the confirm dialog box. Click yes. | |
Console logs "deleting [id]" and "done". | |
If I click delete again, or anything else, THEN the Restangular remove fires and sends the delete request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.delete = function( id ){ | |
var deleteResource = function(){ | |
$resource('api/geekcontest/contests/:id', {'id':id}).delete(); | |
}; | |
window.setTimeout( deleteResource, 5000 ); | |
}; |
OlderNewer