Skip to content

Instantly share code, notes, and snippets.

View malkafly's full-sized avatar
🏠
Working from home

d. malk malkafly

🏠
Working from home
View GitHub Profile
@malkafly
malkafly / gist:6764599
Created September 30, 2013 14:26 — forked from jcsrb/gist:1081548
function get_avatar_from_service(service, userid, size) {
// this return the url that redirects to the according user image/avatar/profile picture
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px )
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word )
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word )
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px )
// everything else will go to the fallback
// google and gravatar scale the avatar to any site, others will guided to the next best version
// Post repeat directive for logging the rendering time
angular.module('myApp').directive('postRepeatDirective',
['$timeout',
function($timeout) {
return function(scope) {
if (scope.$first)
window.a = new Date(); // window.a can be updated anywhere if to reset counter at some action if ng-repeat is not getting started from $first
if (scope.$last)
$timeout(function(){
console.log("## DOM rendering list took: " + (new Date() - window.a) + " ms");
<?php
class MongoAPI{
private $db;
private $col;
private $apiKey;
public function __construct($db,$col,$apiKey){
$this->db = $db;
$this->col = $col;
@malkafly
malkafly / dabblet.css
Created April 30, 2014 22:08
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@malkafly
malkafly / the80.js
Last active August 29, 2015 14:13 — forked from rodrigoalviani/the80.js
$('*').each(function () {
var colors = ['aqua', 'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple', 'red', 'silver', 'teal', 'yellow'];
$(this).css('background-color', colors[Math.floor(Math.random()*colors.length)]);
$(this).css('font-family', 'Comic Sans MS');
});
$('img').each(function () {
var imgs = [
'http://www.animatedgif.net/devilish/coolskul.gif',
'http://www.animatedgif.net/devilish/devildance_e0.gif',
/*
* True Match Team (original 2)
*
* If you are unfamiliar with js, try visit:
* http://www.malkafly.com.br
* adaptado da versão de R. Alviani: https://gist.github.com/rodrigoalviani/977351b31da2c14b9b72
*/
'use strict';
var i = 0;
@malkafly
malkafly / app.js
Last active August 29, 2015 14:20 — forked from jgoux/app.js
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});
@malkafly
malkafly / Program.cs
Created April 27, 2015 13:01
Comparar senhas do Identity
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
var cidades=[{"id":1,"nome":"Acrelandia","ide":1,"cap":0},{"id":2,"nome":"Assis Brasil","ide":1,"cap":0},{"id":3,"nome":"Brasileia","ide":1,"cap":0},{"id":4,"nome":"Bujari","ide":1,"cap":0},{"id":5,"nome":"Capixaba","ide":1,"cap":0},{"id":6,"nome":"Cruzeiro do Sul","ide":1,"cap":0},{"id":7,"nome":"Epitaciolandia","ide":1,"cap":0},{"id":8,"nome":"Feijo","ide":1,"cap":0},{"id":9,"nome":"Jordao","ide":1,"cap":0},{"id":10,"nome":"Mancio Lima","ide":1,"cap":0},{"id":11,"nome":"Manoel Urbano","ide":1,"cap":0},{"id":12,"nome":"Marechal Thaumaturgo","ide":1,"cap":0},{"id":13,"nome":"Placido de Castro","ide":1,"cap":0},{"id":14,"nome":"Porto Acre","ide":1,"cap":0},{"id":15,"nome":"Porto Walter","ide":1,"cap":0},{"id":16,"nome":"Rio Branco","ide":1,"cap":1},{"id":17,"nome":"Rodrigues Alves","ide":1,"cap":0},{"id":18,"nome":"Santa Rosa","ide":1,"cap":0},{"id":19,"nome":"Sena Madureira","ide":1,"cap":0},{"id":20,"nome":"Senador Guiomard","ide":1,"cap":0},{"id":21,"nome":"Tarauaca","ide":1,"cap":0},{"id":22,"nome":"Xapuri
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
// I blantantly stole, tweaked and happily used this code from:
// Lord of Ports http://www.experts-exchange.com/M_1736399.html
$ky = 'lkirwf897+22#bbtrm8814z5qq=498j5'; // 32 * 8 = 256 bit key
$iv = '741952hheeyy66#cs!9hjv887mxx7@8y'; // 32 * 8 = 256 bit iv