Skip to content

Instantly share code, notes, and snippets.

@jury89
jury89 / index.sql
Created April 27, 2017 15:15
MySQL query update a field with an incrementing variable
UPDATE `Users` e,
(SELECT @n := 0) m
SET e.email = concat('my_string+', @n := @n + 1, 'rest')
@jury89
jury89 / DefaultController.php
Last active July 12, 2016 14:56
Symfony - Pragmatically login a user
<?php
class DefaultController extends Controller
{
public function indexAction()
{
// ...
$this->get('fos_user.security.login_manager')->logInUser('firewall_name', $user);
// Or manually
@jury89
jury89 / script.php
Created July 12, 2016 11:26
Symfony - Update user in fosUserBundle
$userManager = $this->container->get('fos_user.user_manager');
$user->setPlainPassword('your_password');
$userAdmin = $userManager->updateUser($user);
@jury89
jury89 / gist:86cfb1d35b7ddd23b3a998c5d0b800cd
Last active May 23, 2016 19:23
Install screen sharing on Raspberry PI 3 (and probably mosts Debian based envs)

Install x11vnc to share the screen between Raspberry PI and OS X using Screen Sharing built-in app.

#Install x11vnc sudo apt-get install x11vnc

Looks like it requires you to set up a password:

x11vnc -storepasswd

#Test installation and connection

@jury89
jury89 / gist:ec2e0ddbfc54b3197b65
Created September 3, 2015 11:51
strongloop - get method name
ctx.methodString
@jury89
jury89 / MyModel.js
Last active September 3, 2015 09:13
Strongloop - get model definition
Model.definition.settings
// to get just a proprerty
Model.definition.settings.propertyName
@jury89
jury89 / myModel.json
Created August 3, 2015 14:11
Loopback hidden properties
"properties": {
"password": {
"type": "string",
"required": true
},
"hidden": ["password"],
@jury89
jury89 / gist:e00b722e47b2a0930d1b
Created May 27, 2015 11:15
command to get the access context in loopback
env DEBUG=loopback:security:access-context slc run
@jury89
jury89 / gist:5ec41770d8a207a8ad53
Created May 15, 2015 14:22
Debug Roles in Strongloop
env DEBUG=loopback:security:acl slc run
@jury89
jury89 / gist:fa4abdf958f9752f8f08
Created May 15, 2015 14:21
debug SQL in Strongloop
env DEBUG=loopback:connector:mysql,loopback:relations node server/server.js