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 | |
/** | |
* MYSQL Reference: http://softonsofa.com/tweaking-eloquent-relations-how-to-get-n-related-models-per-parent/ | |
* PGSQL Reference: http://stackoverflow.com/questions/21154752/postgresql-limit-for-each-in-clause | |
*/ | |
class BaseModel extends \Eloquent { | |
/** | |
* query scope nPerGroup |
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
$value = array( | |
"deep"=>1, | |
"data"=>null, | |
"node"=>array( | |
"deep"=>2, | |
"data"=>null, | |
"node"=>array( | |
"deep"=>3 | |
) | |
), |
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
NSSet *products = [NSSet setWithArray:@[@"PRODUCT"]]; | |
[[RMStore defaultStore] requestProducts:products success:^(NSArray *products, NSArray *invalidProductIdentifiers) { | |
for (int i = 0; i < [products count]; ++i) | |
{ | |
SKProduct *p = products[i]; | |
NSLog(@"Product title: %@" , p.localizedTitle); | |
NSLog(@"Product description: %@" , p.localizedDescription); | |
NSLog(@"Product price: %@" , p.price); |
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
-(BOOL) NSStringIsValidEmail:(NSString *)checkString | |
{ | |
BOOL stricterFilter = NO; // Discussion http://blog.logichigh.com/2010/09/02/validating-an-e-mail-address/ | |
NSString *stricterFilterString = @"[A-Z0-9a-z\\._%+-]+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,4}"; | |
NSString *laxString = @".+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2}[A-Za-z]*"; | |
NSString *emailRegex = stricterFilter ? stricterFilterString : laxString; | |
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; | |
return [emailTest evaluateWithObject:checkString]; | |
} |
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
#!/bin/bash | |
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
yum -y install docker-io | |
docker run centos /bin/echo "Hello World" | |
chkconfig docker on | |
service docker start |
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
#!/bin/bash | |
. /etc/rc.d/init.d/functions | |
test -x /usr/bin/hhvm || exit 0 | |
case "$1" in | |
start) | |
#/usr/bin/hhvm --config /etc/hhvm/config.hdf --user apache --mode daemon | |
/usr/bin/hhvm --config /etc/hhvm/config.hdf --mode daemon -vServer.Type=fastcgi -vServer.Port=9000 |
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
input { | |
file { | |
type => "nginx_access" | |
codec=>json | |
path => ["/var/log/nginx/**"] | |
exclude => ["*.gz", "error.*"] | |
discover_interval => 10 | |
sincedb_path => "/opt/logstash/.sincedb" | |
} | |
} |
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
#!/bin/bash | |
#install fswatch | |
brew install fswatch | |
#fswatch to keep a directory in sync with other directory | |
fswatch-run /Users/tureki/Desktop/files/ /Users/tureki/sh/rsync.sh |
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
#!/bin/bash | |
export PGCLIENTENCODING="UTF8" | |
DBLIST="$@" | |
if [ -z "${DBLIST}" ]; then | |
DBLIST="all" | |
fi | |
#backup directory | |
BACKUP=/var/backup/database/mysql/ |
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
#!/bin/bash | |
export PGCLIENTENCODING="UTF8" | |
DBLIST="$@" | |
if [ -z "${DBLIST}" ]; then | |
DBLIST="citytalk" | |
fi | |
#backup directory | |
BACKUP=/var/backup/database/pgsql/ |
NewerOlder