Skip to content

Instantly share code, notes, and snippets.

View alterebro's full-sized avatar

Jorge Moreno alterebro

View GitHub Profile
// GIF Loop Coder Sketch
// https://twitter.com/alterebro/status/669190984014675970
// http://www.gifloopcoder.com/
// short link to this page : http://git.io/vBGBs
function onGLC(glc) {
// -------------
// Size Vars
var W = 600;

Harp compiled site deployment to GitHub pages

  • Set up the repository : PUBLIC & initialize the repository with a readme file

  • Clone it and navigate to the repository folder

	$ git clone https://github.com/user/repository
	$ cd repository/
@alterebro
alterebro / db-backup.php
Last active August 29, 2015 14:18
Backup Your MySQL Database Using PHP
<?php
// Backup Your MySQL Database Using PHP
// ------------------------------------
// Source : http://davidwalsh.name/backup-mysql-database-php
// Use : backup_tables('localhost','username','password','blog');
// ( - 5th param would be the tables, empty or * will get all the complete db. )
/* Backup the db OR just a table */
@alterebro
alterebro / sync.md
Last active January 2, 2016 18:02
Sync gh-pages and master repository

###Sync gh-pages and master

git add .
git status // to see what changes are going to be commited
git commit -m 'Some descriptive commit message'
git push origin master


git checkout gh-pages // go to the gh-pages branch
git rebase master // bring gh-pages up to date with master
/* -----------------------
root
├─ index.html
├─ dev
│ ├─ hmtl
│ ├─ images
│ ├─ js
│ └─ less
@alterebro
alterebro / obfuscate-string.js
Last active March 25, 2016 11:30
Encode a string flipping and rot47ing it
(function() {
var obfuscate = {
flip : function(x) {
var flipped = '';
for ( var i=(x.length)-1; i >= 0; i--) {
flipped += x[i];
};
return flipped;
/*************************************************************************
* File: ternary-sierpinski.js
* Author: Keith Schwarz (htiek@cs.stanford.edu)
*
* An implementation of the ternary Sierpinski triangle algorithm for
* drawing approximations of the Sierpinski triangle.
*
* This algorithm works by subdividing the triangle into three smaller
* triangles, one in each corner. These are labeled 0, 1, and 2 according
* to some consistent ordering. We then write out the numbers 0, 1, 2,