Skip to content

Instantly share code, notes, and snippets.

function fibonacci(n) {
const array = [];
if (n >= 1) {
array.push(0);
}
if (n >= 2) {
array.push(1);
}
@DianaEromosele
DianaEromosele / Change "origin" of your GIT repository
Created August 7, 2016 00:31
Change "origin" of your GIT repository
$ git remote rm origin
$ git remote add origin [email protected]:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
@profstein
profstein / RESPONSIVE-GOOGLE-MAP.md
Last active July 26, 2021 10:32
Responsive Google Map Embed

Responsive Google Maps Embed

This HTML and CSS shows how to embed a Google Map so that it is responsive and resizes with the window. To use it in your project you need to change two things:

  1. The iframe in the map.html on line 2. You would copy and paste this from the Google Map you wanted to embed
  2. The padding bottom on line 13 of map.css Read the instructions on lines 9–12 of that file.
@sangeeths
sangeeths / github-to-bitbucket
Created March 10, 2014 15:24
Forking a Github repo to Bitbucket
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone [email protected]:abc/myforkedrepo.git
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync [email protected]:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v
@guimadaleno
guimadaleno / validar-cpf.php
Last active March 8, 2022 18:20
Função simples para validar CPF (autor desconhecido)
<?php
function is_cpf_valid ($cpf)
{
$cpf = preg_replace("/[^0-9]/", "", $cpf);
$digitoUm = 0;
$digitoDois = 0;
for($i = 0, $x = 10; $i <= 8; $i++, $x--):
$digitoUm += $cpf[$i] * $x;
endfor;
<?php
$link = mysql_connect("localhost", "root", "");
if(!$link) {
die("There is a problem:<br />" . mysql_error());
}
if(!mysql_select_db("DATA_BASE_NAME")) {
die(mysql_error());
}
@guisehn
guisehn / gist:3276302
Last active June 27, 2024 01:40
Validar CNPJ (PHP)
<?php
function validar_cnpj($cnpj)
{
$cnpj = preg_replace('/[^0-9]/', '', (string) $cnpj);
// Valida tamanho
if (strlen($cnpj) != 14)
return false;