Skip to content

Instantly share code, notes, and snippets.

View caferrari's full-sized avatar

Carlos A. Ferrari caferrari

View GitHub Profile
@tvaliasek
tvaliasek / ADClient.js
Last active March 30, 2022 18:40
node activedirectory - check if user is locked, disabled or expired and get date of last password change
/*
To get some attributes from AD, you need to set the correct permissions on the container
or object you are trying to read. (e.g., pwdLastSet, userAccountControl)
*/
const ActiveDirectory = require('activedirectory')
/* eslint-disable-next-line no-unused-vars */
const SCRIPT_FLAG = 0
const ACCOUNTDISABLE_FLAG = 1
/* eslint-disable-next-line no-unused-vars */
@yefim
yefim / Dockerrun.aws.json
Last active April 7, 2023 16:11
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "443"
}
$scope.scanCode = function () { // Scan code
$ionicLoading.show({
template: '<ion-spinner></ion-spinner>'
});
console.log("scanCode run");
if ($scope.currentlyScanning === true) {
$ionicLoading.hide();
return;
}
else if (ionic.Platform.platforms.indexOf("browser") !== -1) {
@idej
idej / yahooLogin.js
Created March 24, 2015 19:52
getting yahoo oauth 2.0 tokens in your ionic application
//should install cordova InAppBrowser plugin
//http://docs.phonegap.com/en/edge/cordova_inappbrowser_inappbrowser.md.html
//yahoo configs
//YAHOO.clientId, clientSecret - your yahoo application values - https://developer.yahoo.com/
//YAHOO.redirectUri - your redirect uri (should be with domain that set in yahoo app configs)
var YAHOO = {
clientId: 'xxxxxxx',
clientSecret: 'xxxxxxx',
redirectUrl: 'your redirect url',
@MarcDiethelm
MarcDiethelm / Contributing.md
Last active May 1, 2024 18:06
How to contribute to a project on Github

This text now lives at https://github.com/MarcDiethelm/contributing/blob/master/README.md. I turned it into a Github repo so you can, you know, contribute to it by making pull requests.


Contributing

If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.

@netojoaobatista
netojoaobatista / 1lr-query.php
Last active December 15, 2015 18:39
Obtendo registros aleatórios de uma base sem utilizar ORDER BY RAND()
<?php
$pdo = new PDO('mysql:host=127.0.0.1;dbname=base', 'user', 'pswd');
$stm = $pdo->query('
SET @count = (SELECT COUNT(*) FROM tabela);
SET @query = CONCAT("SELECT * FROM `tabela` LIMIT 4 OFFSET ", 1 + FLOOR(RAND() * @count));
PREPARE stmt FROM @query;
EXECUTE stmt;
');
@netojoaobatista
netojoaobatista / Colleague.php
Created February 13, 2013 14:51
Simulação dos grupos do Facebook utilizando Mediator
<?php
class Colleague extends Hashed
{
private $name;
public function __construct($name)
{
$this->name = $name;
}

Factories e Interfaces no Respect\Config

Oi de novo! Dia produtivo. Temos novas funcionalidades no Respect\Config também:

Factories e Builders

O Respect\Config gerencia as configurações de seus objetos, incluindo quem depende de quem.

@alganet
alganet / CONTRIBUTING.md
Created April 11, 2012 02:47
Respect\Validation - How to Contribute

Respect\Validation - How to Contribute

This is a guide for anyone willing to contribute with Respect\Validation. Anyone can contribute!

Please see the project documentation before proceeding. You should also know about PSR-0 and basic unit testing, but I'm sure you can learn that just by looking at other rules. Pick the simple ones like Int to begin.

Before writing anything, make sure there is no validator that already does what you need. Also, it would be awesome if you open an issue before starting, so if anyone has the same idea the guy will see that you're already doing that.

Adding a new Validator

@netojoaobatista
netojoaobatista / String.prototype.soundex.js
Created March 22, 2012 18:00
Implementação do algorítimo SoundEX em Javascript
/**
* Implementação do algorítimo SoundEx em Javascript.
* @author João Batista Neto
*
* SoundEX é um algorítimo fonético para indexação de nomes pelo som segundo
* sua pronúncia. O algorítimo foi desenvolvido por Robert C. Russell e
* Margaret K. Odell e patenteado em 1918 e 1922.
* {@link http://en.wikipedia.org/wiki/Soundex}
*
* @return {String}