Skip to content

Instantly share code, notes, and snippets.

View brayancruces's full-sized avatar
🎯
Focusing

Brayan Cruces brayancruces

🎯
Focusing
View GitHub Profile
@datphan126
datphan126 / book-offline.service.ts
Created February 23, 2020 22:40
Book Offline Service for CRUD
import { Injectable } from '@angular/core';
import Dexie from 'dexie';
import { Book } from '../books/books.component';
import { OnlineOfflineService } from './online-offline.service';
import { v1 as uuidv1 } from 'uuid'; // For generating time-based uuid
import { BackendService } from './backend.service';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Subject } from 'rxjs';
import { take } from 'rxjs/operators';
@hackjutsu
hackjutsu / upstream.md
Last active December 11, 2023 07:44
[set upstream] What does '--set-upstream' do? #tags: git
git branch --set-upstream-to <remote-branch>
# example
git branch --set-upstream-to origin feature-branch

# show up which remote branch a local branch is tracking
git branch -vv

sets the default remote branch for the current local branch.

@rmkane
rmkane / GAME_MASTER_v0_1.json
Created July 17, 2016 04:25
Pokemon GO Game Data
{
"Items": [ {
"TemplateId": "BADGE_BATTLE_ATTACK_WON",
"Badge": {
"BadgeType": "BADGE_BATTLE_ATTACK_WON",
"BadgeRanks": 4,
"Targets": "\\nd\\350\\007"
}
}, {
"TemplateId": "BADGE_BATTLE_TRAINING_WON",
anonymous
anonymous / GAME_MASTER_v0_1.protobuf
Created July 16, 2016 16:31
Pokemon Go decoded GAME_MASTER protobuf file v0.1
Result: 1
Items {
TemplateId: "BADGE_BATTLE_ATTACK_WON"
Badge {
BadgeType: BADGE_BATTLE_ATTACK_WON
BadgeRanks: 4
Targets: "\nd\350\007"
}
}
Items {
@sword-jin
sword-jin / readme.md
Last active June 26, 2016 23:39
红路灯撞车

Consider an Uber-City where the only passenger vehicles on the roads are self-driving Uber cars. Since all the cars are self-driving, you could synchronize the car speeds in such a way that traffic lights would be obsolete.

As a first step you need to implement an algorithm that would check whether removing traffic lights at a given intersection of two one-way roads will lead to a car crash.

For each road you know when a car will approach the crossroads. You also know how long it takes to cross the crossroads.

Example

import requests
def get_data_doc_number(user, password, tipo_doc, numero_doc, format='json'):
'''
# url = 'http://py-devs.com:8888/api'
url = 'http://py-devs.com/api'
tipo_doc = 'dni' o 'ruc'
'''
url = 'http://py-devs.com/api'
# url = 'http://localhost:8000/api'
@helgatheviking
helgatheviking / kia_convert_country_code.php
Created December 7, 2015 19:01
Converts the WooCommerce country codes to 3-letter ISO codes
<?php
/**
* Converts the WooCommerce country codes to 3-letter ISO codes
* https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
* @param string WooCommerce's 2 letter country code
* @return string ISO 3-letter country code
*/
function kia_convert_country_code( $country ) {
$countries = array(
'AF' => 'AFG', //Afghanistan
@RobertTalbert
RobertTalbert / bitwiseXOR.md
Last active October 14, 2015 06:36
Example of bitwise XOR encryption

This is an example of how the bitwise XOR can be used to make a simple encryption system.

Suppose Alice wants to send the message CAT to Bob using the key 11000101.

First: Convert the characters in the message to ASCII:

  • C = 01000011
  • A = 01000001
  • T = 01010100
@gilbitron
gilbitron / .env.travis
Last active August 12, 2023 08:06
Laravel 5 Travis CI config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync