This file contains hidden or 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
# 1. Create a new file at /Library/LaunchDaemons/org.mongo.mongod.plist | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.mongo.mongod</string> | |
<key>RunAtLoad</key> | |
<true/> |
This file contains hidden or 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 | |
// connect | |
$m = new Mongo(); | |
// select a database | |
$db = $m->comedy; | |
// select a collection (analogous to a relational database's table) | |
$collection = $db->cartoons; |
This file contains hidden or 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
# 1. Run the installer | |
cd /usr/lib/php | |
sudo php install-pear-nozlib.phar | |
### 2. Edit /etc/php.ini and find the line: ;include_path = ".:/php/includes" and change it to: ### | |
# If you don't have php.ini you should have php.ini.default run "sudo cp php.ini.default php.ini" | |
include_path = ".:/usr/lib/php/pear" |
This file contains hidden or 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
// connect | |
$m = new Mongo(); | |
// select a database | |
$db = $m->shugah; | |
// select a collection (analogous to a relational database's table) | |
$collection = $db->entry_types; | |
// find everything in the collection |
This file contains hidden or 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
# Disable | |
EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all" | |
# Enable | |
exec sp_msforeachtable @command1="print '?'", @command2="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all" |
This file contains hidden or 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
EXEC sp_MSforeachtable "DBCC CHECKIDENT ( '?', RESEED, 0)" |
This file contains hidden or 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
class MyClass(): | |
def __init__(self, **kwargs): | |
self.__dict__.update(**kwargs) |
This file contains hidden or 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
# Tag the archive | |
git tag archive/<branchname> <branchname> | |
# Delete the branch | |
git branch -d <branchname> | |
# To restore the branch, checkout from the tag | |
git checkout -b <branchname> archive/<branchname> |
This file contains hidden or 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 sqlalchemy import desc, func | |
from libs.database import Session | |
def importer(name): | |
mod = __import__(name) | |
components = name.split('.') | |
for comp in components[1:]: | |
mod = getattr(mod, comp) | |
return mod |
This file contains hidden or 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
import pprint | |
from sqlalchemy import desc, func | |
from libs.database import Session | |
def importer(name): | |
mod = __import__(name) | |
components = name.split('.') | |
for comp in components[1:]: |
OlderNewer