Skip to content

Instantly share code, notes, and snippets.

Avatar
:atom:
Data & Mathematics lover.

Leonardo Rifeli leonardorifeli

:atom:
Data & Mathematics lover.
View GitHub Profile
@xthiago
xthiago / Approach 01 - rely on a third-party service.md
Last active Jul 16, 2019
Alternatives to test classes that rely on system time.
View Approach 01 - rely on a third-party service.md

Value object that depends on system time:

<?php

declare(strict_types=1);

namespace Xthiago;

final class BirthDate
View sendString.js
// the wizare functions
var sendString = (function(rfb, force, sendDelay) {
sendDelay = sendDelay || 25;
var _q = [];
var _qStart = function() {
var chr = _q.shift();
if (chr) {
rfb.sendKey(chr);
setTimeout(_qStart, sendDelay);
}
@haircut
haircut / Install PIP to user site on macOS.md
Created Aug 29, 2017
How to install and use pip without sudo or admin on macOS
View Install PIP to user site on macOS.md

Install and use pip on macOS without sudo / admin access

Most recently tested on macOS Sierra (10.12.6)

  1. Download the installation script; curl https://bootstrap.pypa.io/get-pip.py -o ~/Downloads/get-pip.py
  2. Run the installation, appending the --user flag; python ~/Downloads/get-pip.py --user. pip will be installed to ~/Library/Python/2.7/bin/pip
  3. Make sure ~/Library/Python/2.7/bin is in your $PATH. For bash users, edit the PATH= line in ~/.bashrc to append the local Python path; ie. PATH=$PATH:~/Library/Python/2.7/bin. Apply the changes, source ~/.bashrc.
  4. Use pip! Remember to append --user when installing modules; ie. pip install <package_name> --user

Note

@coboshm
coboshm / golang_kinesis.go
Created Aug 21, 2017
Golang + Kinesis firehose
View golang_kinesis.go
package main
import (
"log"
"encoding/json"
"fmt"
"os"
"math/rand"
@satendrakumar
satendrakumar / DataFrameWithFileName.scala
Last active Apr 15, 2020
Add file name as Spark DataFrame column
View DataFrameWithFileName.scala
import org.apache.spark.sql.functions._
import org.apache.spark.sql.SparkSession
object DataFrameWithFileNameApp extends App {
val spark: SparkSession =
SparkSession
.builder()
.appName("DataFrameApp")
.config("spark.master", "local[*]")
@leonardorifeli
leonardorifeli / People.php
Last active Sep 22, 2017
Working with annotations using the doctrine annotation reader
View People.php
<?php
/**
* @PeopleAnnotation(description="Get all information about a people", type="class")
*/
class People {
/**
* @PeopleAnnotation(description="Use to people name", type="attribute")
*/
@leonardorifeli
leonardorifeli / generator.php
Created Oct 15, 2015 — forked from tawfekov/generator.php
Doctrine2 Generate Entities form Existing Database
View generator.php
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@netojoaobatista
netojoaobatista / gitcowsay.sh
Last active Apr 9, 2020
Random commit messages
View gitcowsay.sh
git config --global alias.cowsay '!git commit -m "`fortune | cowsay -f tux`"'
View validate.php
public function validate()
{
return $this->loginValidate();
}
private function loginValidate($attempt = 0)
{
try {
if ($this->user->validarDadosLogin()) {
//Autenticaçõa na base de dados
@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active Aug 7, 2020
Restart Bluetooth Daemon on Mac OS X without restarting
View restart_bluetooth.sh
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
You can’t perform that action at this time.