Skip to content

Instantly share code, notes, and snippets.

@nayzawoo
nayzawoo / autocomplete.php
Created December 10, 2016 09:01 — forked from imranismail/autocomplete.php
Laravel And JqueryUI's Autocomplete Plugin
//SearchController.php
public function autocomplete(){
$term = Input::get('term');
$results = array();
$queries = DB::table('users')
->where('first_name', 'LIKE', '%'.$term.'%')
->orWhere('last_name', 'LIKE', '%'.$term.'%')
->take(5)->get();
[user]
email = nayzawoo.me@gmail.com
name = Nay Zaw Oo
[alias]
l0g1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
log2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
log = !"git lg1"
[credential]
helper = cache --timeout=3600
<%
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
' Copyright (C) 2003-2008 Frederico Caldeira Knabben
'
' == BEGIN LICENSE ==
'
' Licensed under the terms of any of the following licenses at your
' choice:
'
' - GNU General Public License Version 2 or later (the "GPL")
@nayzawoo
nayzawoo / backup.sh
Created May 4, 2017 07:02
Mongodb/files backup bash
#!/bin/bash
# sudo midir /var/www/backups
# sudo database/backup
MONGO_DATABASE="my_app_db"
APP_NAME="my_app"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
@nayzawoo
nayzawoo / pricing-ec2-vs-digitalocean.md
Created June 25, 2017 10:15 — forked from jbenner-radham/pricing-ec2-vs-digitalocean.md
Pricing comparison for Amazon AWS EC2 vs. Digital Ocean

Amazon EC2 and DigitalOcean Comparison

              | EC2 Small (previous gen) | Digital Ocean 2GB

-----------------|--------------------------|------------------ Hourly Price | $0.044 | $0.03 Monthy Price | $32 | $20 RAM | 1.7GB | 2GB HDD | 160GB | 40GB (SDD) CPU | x1 | x2 Monthy Transfer | 1GB | 3TB

@nayzawoo
nayzawoo / gist:63d50ff8060242a142b3dcc4437f8c60
Created November 30, 2017 08:23 — forked from jcsrb/gist:1081548
get avatar from google profiles, facebook, gravatar, twitter, tumblr
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
@nayzawoo
nayzawoo / gist:4e9bc8aa73e44ed1f3ba30727cdab6b6
Created November 30, 2017 08:23 — forked from jcsrb/gist:1081548
get avatar from google profiles, facebook, gravatar, twitter, tumblr
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
@nayzawoo
nayzawoo / test.js
Created January 10, 2018 08:41
Fix Floating Point Error
var floatNumber = 0.1
floatNumber * 2 //=> 0.2
floatNumber * 3 //=> 0.30000000000000004
((floatNumber * 10e10) * 3) / 10e10 // => 0.3
@nayzawoo
nayzawoo / AES-256 encryption and decryption in PHP and C#.md
Created January 30, 2018 09:08
AES-256 encryption and decryption in PHP and C#

AES-256 encryption and decryption in PHP and C#

PHP

<?php

$plaintext = 'My secret message 1234';
$password = '3sc3RLrpd17';
$method = 'aes-256-cbc';