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
protected static function delete_translations($obj) | |
{ | |
$translation = static::find(function($query) use($obj){ | |
$query->where('parent_id', $obj->id); | |
}); | |
foreach($translation as $row) | |
{ | |
$row->delete(); | |
} |
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
public function getByLatLng($lat, $lng, $range = 5000 /* KM */, $earthRadius = 6378 /* Unit Earth Radius */) { | |
\Config::load('db'); | |
$mongoConf = \Config::get('mongo'); | |
$monga = \Monga::connection('mongodb://' . $mongoConf['default']['hostname'] . ':27017'); | |
$database = $monga->database($mongoConf['default']['database']); | |
$nameCache = 'company_get_by_' . $lat . '_' . $lng; | |
try { |
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 | |
$objects = new RecursiveIteratorIterator | |
(new RecursiveDirectoryIterator(__DIR__), | |
RecursiveIteratorIterator::SELF_FIRST); | |
foreach ($objects as $path => $fileObject) { | |
if ( ! is_dir($fileObject)) { | |
continue; |
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 | |
function __curry($callback, Reflector $reflector = null, $arguments = array(), $numArgs = null) | |
{ | |
if ( ! $reflector) { | |
$reflector = new ReflectionFunction($callback); | |
} | |
if ($numArgs === null) { | |
$numArgs = $reflector->getNumberOfRequiredParameters(); |
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
--- | |
- name: Commmon | MailUtils | |
apt: pkg=mailutils state=latest | |
- name: Commmon | sqlite3 | |
apt: pkg=sqlite3 state=latest | |
- name: Commmon | libsqlite3-dev | |
apt: pkg=libsqlite3-dev state=latest |
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
### Keybase proof | |
I hereby claim: | |
* I am FrenkyNet on github. | |
* I am frenkynet (https://keybase.io/frenkynet) on keybase. | |
* I have a public key whose fingerprint is 3ED4 AF00 97B3 C922 5340 D2F6 5276 297F FD01 F1D8 | |
To claim this, I am signing this object: |
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
--- | |
suites: | |
some_suite: | |
namespace: Name\Space | |
psr4_prefix: Name\Space |
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
var gulp = require('gulp'); | |
var spawn = require('child_process').spawn; | |
var subprocess; | |
function refreshGulpfile() { | |
if (subprocess) subprocess.kill(); | |
subprocess = spawn('gulp', ['watched-default'], {stdio: 'inherit'}); | |
} | |
gulp.task('default', function () { |
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 | |
$stream = $fs->readStream($file); | |
// send the right headers | |
header("Content-Type: " . $fs->getMimetype($file)); | |
header("Content-Length: " . $fs->getSize($file)); | |
header("Content-disposition: attachment; filename=\"" . basename($file) . "\""); | |
// dump the attachement and stop the script |
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 | |
use GuzzleHttp\Post\PostFile; | |
$request = $client->createRequest('POST', 'http://example.com/'); | |
$postBody = $request->getBody(); | |
$readStream = $flysystem->readStream($fileLocation); | |
$postBody->addFile(new PostFile('test', $readStream); | |
$response = $client->send($request); |
OlderNewer