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 | |
namespace My\Security\Factory; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\Security\Core\Exception\BadCredentialsException; | |
use Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener; | |
use Symfony\Component\Security\Http\Firewall\AbstractAuthenticationListener; | |
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; | |
use Symfony\Component\Security\Core\SecurityContextInterface; |
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 | |
$file = new SplFileObject('/path/to/file.csv', 'rb'); | |
$file->setFlags(SplFileObject::READ_CSV | SplFileObject::SKIP_EMPTY); | |
$file->setCsvControl(';'); | |
foreach($file as $data) { | |
// $data is array | |
} |
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 | |
/** | |
* Admin area. | |
*/ | |
class AdminController extends Zend_Controller_Action { | |
public function preDispatch() { | |
if ( |
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
<glade-catalog name="save_project_repository_notifier_dialog" domain="glade-3" | |
depends="gtk+" version="1.0"> | |
<glade-widget-classes> | |
<glade-widget-class title="Save Project" name="SaveProjectRepositoryNotifierDialog" | |
generic-name="SaveProjectRepositoryNotifierDialog" parent="GtkDialog" | |
icon-name="widget-gtk-window"/> | |
</glade-widget-classes> | |
</glade-catalog> |
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
print tmp['logs'] | |
print dict(tmp['logs'].items()) | |
tmp['logs'] = dict(tmp['logs'].items()) | |
print tmp['logs'] | |
prints: | |
<desktopcouch.records.RecordDict object at 0xa1d0f0c> | |
{} | |
<desktopcouch.records.RecordDict object at 0xa1d0f0c> |
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
from desktopcouch.records.server import CouchDatabase | |
from desktopcouch.records.record import Record | |
RECORD_TYPE_TEST = 'http://umpirsky.com/record-type/test' | |
db = CouchDatabase('desktopcouchbug', create=True) | |
db.put_record(Record({ | |
'record_type': RECORD_TYPE_TEST, | |
'name': 'test record', | |
'dict': {} |
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
RECORD_TYPE_TEST = 'http://umpirsky.com/record-type/test' | |
db = CouchDatabase('desktopcouchbug', create=True) | |
##db.put_record(Record({ | |
## 'record_type': RECORD_TYPE_TEST, | |
## 'name': 'test record', | |
## 'dict': {} | |
##})) | |
record = db.get_record('5h5FK4cMbvgSheFDoY5mPT') | |
record['dict']['1'] = {'path': 'foo'} |
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
$sudo python setup.py install --prefix=/usr/local | |
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe' | |
warnings.warn(msg) | |
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'include_package_data' | |
warnings.warn(msg) | |
running install | |
running build | |
running build_py | |
running build_scripts | |
running install_lib |
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
client, path = get_transport_and_path('git://github.com/jelmer/dulwich.git') | |
repo = Repo('/home/umpirsky/Projects/Python/dullwich') | |
remote_refs = client.fetch(path, repo) | |
for k, remote_ref in remote_refs.iteritems(): | |
print repo[remote_ref] |
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
client, path = get_transport_and_path('git://github.com/jelmer/dulwich.git') | |
repo = Repo('/home/umpirsky/Projects/Python/dullwich') | |
remote_refs = client.fetch(path, repo) | |
for commit in repo.revision_history(remote_refs['refs/heads/master'])[:3]: | |
write_tree_diff(sys.stdout, repo.object_store, commit.parents[0], commit.tree) | |
sys.exit() |