Skip to content

Instantly share code, notes, and snippets.

View loureirorg's full-sized avatar

Daniel Loureiro loureirorg

View GitHub Profile
@nagi1
nagi1 / bitbucket-pipeline.yaml
Created April 18, 2021 20:59
Example bitbucket-pipeline.yaml that works with laravel envoy. See https://ahmednagi.com/laravel-deploy-bitbucket
image: php:7.4-fpm
definitions:
steps:
- step: &composer-install
name: Build PHP
caches:
- composer
script:
- ls -al
@cagartner
cagartner / deploy.sh
Last active October 12, 2024 17:56
Laravel Push deploy Github actions example
#!/bin/sh
set -e
vendor/bin/phpunit
(git push) || true
git checkout production
git merge master
@slayerfat
slayerfat / phpmd-ruleset.xml
Last active September 15, 2024 15:00
php mess detector ruleset for laravel and similar frameworks
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Laravel and similar phpmd ruleset"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Inspired by https://github.com/phpmd/phpmd/issues/137
using http://phpmd.org/documentation/creating-a-ruleset.html
</description>
@SerafimArts
SerafimArts / Ai.php
Last active March 26, 2023 05:58
AI (Adobe Illustrator) Reader
<?php
namespace app\support\lib;
class Rect
{
protected $left;
protected $top;
protected $width;
protected $height;
@keithdevon
keithdevon / manual-gravity-forms
Created September 25, 2014 21:05
Manually create entries and send notifications with Gravity Forms
<?php
// Manually create entries and send notifications with Gravity Forms
$form_id = 10;
// add entry
$entry = array(
"form_id" => $form_id,
"1" => "Entry for field ID 1",
@jackrg
jackrg / active_record.rb
Created May 16, 2014 18:14
Add bulk import functionality to Rails Active Record (add this file to config/initializers, call <model>.import!(array-of-record-hashes))
class ActiveRecord::Base
def self.import!(record_list)
raise ArgumentError "record_list not an Array of Hashes" unless record_list.is_a?(Array) && record_list.all? {|rec| rec.is_a? Hash }
return record_list if record_list.empty?
(1..record_list.count).step(1000).each do |start|
key_list, value_list = convert_record_list(record_list[start-1..start+999])
sql = "INSERT INTO #{self.table_name} (#{key_list.join(", ")}) VALUES #{value_list.map {|rec| "(#{rec.join(", ")})" }.join(" ,")}"
self.connection.insert_sql(sql)