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
#!/usr/bin/perl | |
use Data::Dumper; | |
use DBI; | |
my $dbh = DBI->connect("", "", "", { AutoCommit => 1 }); | |
my $data = `/usr/local/bin/speedtest-cli --simple`; | |
my @lines = split /\n/, $data; |
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
/** | |
* Replaces a where clause in a Builder with another where clause | |
*/ | |
Builder::macro('replaceWhere', function (Builder $passedQuery, \Closure $howToGetValue) { | |
$wheres = $passedQuery->wheres; | |
$query = $passedQuery->cloneWithout([ 'wheres' ]); | |
$bindings = []; | |
foreach ($wheres as &$where) { |
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
### Keybase proof | |
I hereby claim: | |
* I am gms8994 on github. | |
* I am gms (https://keybase.io/gms) on keybase. | |
* I have a public key ASCHChhicXQkZY3KFtFaXdqMoc-UBiTI3ptvPW5QYZ9r8Qo | |
To claim this, I am signing this object: |
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
### Keybase proof | |
I hereby claim: | |
* I am gms8994 on github. | |
* I am gms (https://keybase.io/gms) on keybase. | |
* I have a public key ASCrMIBpO1U0IJmhCiiL_h2IJ_nJNFIo52aVp0Q-J0DX-wo | |
To claim this, I am signing this object: |
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
public function instantiate($class) { | |
$model = Yii::$app->modelMapper->instantiateObject(strtolower($class)); | |
if (is_null($model)) { | |
$entityConfigId = substr($this->type, strlen("entity_")); | |
$entityConfig = \epmx\frontend\common\models\EntityConfig::findOne(['id' => $entityConfigId]); | |
$model = new \epmx\frontend\common\models\Entity(['entityConfig' => $entityConfig]); | |
} | |
return $model; | |
} |
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
$_vendorModel = $this->instantiate('Vendor')->find()->where(['name' => $vendorModel->name])->one(); | |
if (is_null($_vendorModel)) { | |
$_vendorModel = $this->instantiate('Vendor'); | |
$_vendorModel->name = $vendorModel->name; | |
$success = $_vendorModel->save(); | |
$dirtyAttributes = $itemVendorModel->dirtyAttributes; | |
$dirtyAttributes = array_filter($dirtyAttributes, function($v) { return $v !== ""; }); | |
if (! $success |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use HTML::Entities; | |
use iCal::Parser; | |
use LWP::UserAgent::Cached; | |
use Text::Table; |
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
Form::macro('selectWithAttribs', function($name, $options, $default = null) { | |
$opt = array(); | |
$select = '<select name="' . $name . '">'; | |
foreach ($options as $option) { | |
$opt_node = '<option value="' . $option->value . '"'; | |
$props = $option->getAttributes(); | |
unset($props['value'], $props['key']); | |
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 $css = CSS->new({ 'parser' => 'CSS::Parse::Heavy', 'adaptor' => 'CSS::Adaptor::Debug' }); | |
$css->read_file($css_file); | |
die $css->output(); |
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
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use CSS; | |
my $css = CSS->new({ 'parser' => 'CSS::Parse::Heavy', 'adaptor' => 'CSS::Adaptor::Debug' }); | |
$css->read_file('bootstrap.css'); | |
die $css->output(); |
NewerOlder