Skip to content

Instantly share code, notes, and snippets.

View Fuhrmann's full-sized avatar
:octocat:
here we go

Ricardo Fuhrmann Fuhrmann

:octocat:
here we go
View GitHub Profile
@m4grio
m4grio / Blueprint.php
Last active June 14, 2019 06:45
Extending Laravel 5 Blueprint for MySqlConnection
<?php
namespace App\Database\Schema;
use Illuminate\Database\Schema\Blueprint as ParentBlueprint;
use Illuminate\Support\Facades\DB;
/**
* Class Blueprint
*
@muya
muya / peewee_timestamped_model.py
Last active January 6, 2020 23:50
Timestamped Models in PeeWee
from peewee import *
import datetime
database = SqliteDatabase("/data/amazing_people.db", **{})
class BaseModel(Model):
class Meta:
database = database
@jasonrudolph
jasonrudolph / request.sh
Created April 14, 2015 14:10
Get `starred_at` timestamp for a repository's stargazers via the GitHub API
curl https://api.github.com/repos/atom/atom/stargazers -H 'Accept: application/vnd.github.v3.star+json'
@bowmanb
bowmanb / RxJavaCollectExample.java
Last active February 22, 2020 14:07
RxJava collect() example. Converting a list of phrases into a list of their IDs only.
@Override
public void onNext(ArrayList<Phrase> phrases) {
ArrayList<Integer> phraseIDs = new ArrayList<>();
Observable
.from(phrases)
.collect(phraseIDs, new Action2<ArrayList<Integer>, Phrase>() {
@Override
public void call(ArrayList<Integer> integers, Phrase phrase) {
integers.add(phrase.getId());
}
@Sottti
Sottti / MainActivity.java
Last active November 7, 2019 09:20
Navigation Drawer Sizing according to Material Design
{...}
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
@unity3diy
unity3diy / unity 2d camera follow
Last active January 15, 2024 18:05
unity 2d camera follow script, add this script to camera and drag character or your object into it. simple!
using UnityEngine;
using System.Collections;
public class FollowCamera : MonoBehaviour {
public float interpVelocity;
public float minDistance;
public float followDistance;
public GameObject target;
public Vector3 offset;
@acfreitas
acfreitas / cpfCnpjRandom.php
Last active March 7, 2024 13:54
Gerador de CPF e CNPJ aleatório
/**
* Método para gerar CNPJ válido, com máscara ou não
* @example cnpjRandom(0)
* para retornar CNPJ sem máscar
* @param int $mascara
* @return string
*/
public static function cnpjRandom($mascara = "1") {
$n1 = rand(0, 9);
$n2 = rand(0, 9);
@oanhnn
oanhnn / test.php
Created November 4, 2014 08:44
test performance of array_diff on PHP
<?php
function my_array_diff($a, $b)
{
$map = $out = array();
foreach ($a as $val)
$map[$val] = 1;
foreach ($b as $val)
if (isset($map[$val]))
$map[$val] = 0;
@jirutka
jirutka / -README.md
Last active October 31, 2023 09:07
How to use terminal on Windows and don’t go crazy…

How to use terminal on Windows without going crazy…

Windows is really horrible system for developers and especially for devops. It doesn’t even have a usable terminal and shell, so working with command line is really pain in the ass. If you really don’t want to switch to any usable system (OS X, Linux, BSD…), then this guide should help you to setup somewhat reasonable environment – usable terminal, proper shell, ssh client, git and Sublime Text as a default editor for shell.

Install stuff

  1. Download and install Git for Windows* with:
    • [✘] Use Git from the Windows Command Prompt
  • [✘] Checkout as-is, commit Unix-style line endings
@lavary
lavary / bootstrap-navbar.md
Last active June 17, 2018 19:10
Making multiple menus in a Bootstrap navbar

#Laravel Menu: Bootstrap Navbar

It is possible to create multiple menu instances in a single navbar. I'm going to use Bootstrap default navbar for this demonstration:

First of all we create our menu objects in app/routes.php or app/start/global.php or any other place you desire as long as it is auto loaded when a request hits your application.

routes.php

php