Skip to content

Instantly share code, notes, and snippets.

@lsmith77
lsmith77 / Logitech R700 with reveal.js
Created November 2, 2014 15:41
Logitech R700 with reveal.js
<?xml version="1.0"?>
<!-- Use with KeyRemap4MacBook:
http://pqrs.org/macosx/keyremap4macbook/ -->
<root>
<devicevendordef>
<vendorname>LOGITECH</vendorname>
<vendorid>0x046d</vendorid>
</devicevendordef>
<deviceproductdef>
@lsmith77
lsmith77 / gist:f1ab3fe12fb0813ba4f7
Created June 10, 2015 13:07
this compiler pass fails with "Unable to dump a service container if a parameter is an object or a resource."
<?php
namespace Liip\TranslationBundle\DependencyInjection\Compiler;
use Doctrine\ODM\PHPCR\Mapping\Annotations\Reference;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Compiler pass to dynamically set the service for isGrant checks (can be removed when requiring Symfony 2.6+
Verifying that +lsmith is my blockchain ID. https://onename.com/lsmith
<?php
$security_provider = getenv('SECURITY_PROVIDER');
if (empty($security_provider)) {
if ('dev' === getenv('APP_ENVIRONMENT')) {
$security_provider = 'chain_provider';
} else {
$security_provider = 'ldap';
}
}
@lsmith77
lsmith77 / gist:6f352592b0a460fb0886f4cec82d51de
Created February 2, 2017 14:18
propel join with additional condition on a date
// also tried using addJoinObject + addJoinCondition but either way the condition just gets ignored
$results = $this->getFooQuery()
->addJoin(
FooTableMap::COL_ID,
BarTableMap::COL_ITEM_ID,
Criteria::LEFT_JOIN
)
->addCond(BarTableMap::COL_UPDATED_AT, $updatedAt->format('Y-m-d H:i:s'), Criteria::LESS_THAN)
->toString()
;
# /dev/ci/setup_ssh.sh
#!/usr/bin/env bash
which ssh-agent || (apt-get update -y && apt-get install openssh-client -y)
eval $(ssh-agent -s)
ssh-add <(echo "$PLATFORMSH_DEPLOY_KEY")
mkdir -p ~/.ssh
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
parameters:
file_upload_mime_types:
- application/pdf
- application/x-pdf
- text/plain
- application/rtf
- image/*
- application/msword
- application/vnd.openxmlformats-officedocument.wordprocessingml.document
@lsmith77
lsmith77 / DoctrineMigrationTest.php
Last active July 27, 2023 19:12
PHPUnit functional test to check if migrations inside a Symfony app
<?php
namespace AppBundle\Tests;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\Tools\SchemaTool;
use Doctrine\DBAL\Driver\PDOMysql\Driver as MySQLDriver;
class DoctrineMigrationTest extends WebTestCase
{
const data = require('../Downloads/Slack/diversity-inclusion/2019-03-07.json');
const usersExport = require('../Downloads/Slack/users.json');
// Load all users into memory.
const users = {};
const contributors = {};
usersExport.forEach(user => {
users[user.id] = user.profile.display_name_normalized ? user.profile.display_name_normalized : user.profile.real_name_normalized;
});
@lsmith77
lsmith77 / diff
Created October 8, 2019 15:11
multi currency in Spark
diff --git a/resources/views/vendor/spark/auth/register-common.blade.php b/resources/views/vendor/spark/auth/register-common.blade.php
index 4c78546..30cd926 100644
--- a/resources/views/vendor/spark/auth/register-common.blade.php
+++ b/resources/views/vendor/spark/auth/register-common.blade.php
@@ -95,7 +95,7 @@
</span>
<span v-else class="table-plan-text">
- <strong class="table-plan-price">@{{ plan.price | currency }}</strong>
+ <strong class="table-plan-price">@{{ plan.price | currency(plan.attributes.currency, plan.attributes.currencyLocale) }}</strong>