Skip to content

Instantly share code, notes, and snippets.

<?php
// Originally by Andrew Moore
// Src: http://stackoverflow.com/questions/4795385/how-do-you-use-bcrypt-for-hashing-passwords-in-php/6337021#6337021
//
// Heavily modified by Robert Kosek, from data at php.net/crypt
class Bcrypt {
private $rounds;
private $prefix;

MacOS

Build 3059

Download from here:

http://d.pr/f/QE3d

MD5: 59bab8f71f8c096cd3f72cd73851515d

{
"auto_indent": true,
"bold_folder_labels": true,
"caret_style": "phase",
"detect_indentation": false,
"draw_indent_guides": true,
"draw_white_space": "selection",
"fade_fold_buttons": false,
"find_selected_text": true,
"fold_buttons": true,
@laptrinhcomvn
laptrinhcomvn / Clean Install – OS X 10.11 El Capitan.md
Last active January 14, 2016 06:49 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@laptrinhcomvn
laptrinhcomvn / genymotionwithplay.txt
Created February 15, 2016 08:53 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
@laptrinhcomvn
laptrinhcomvn / Setup Ruby on Debian Wheezy.md
Created June 18, 2016 15:45
Setup rbenv + ruby on Debian 7.1 (Wheezy)

Update and install required packages:

$ apt-get update -y
$ apt-get install -y g++ gcc make libc6-dev patch openssl ca-certificates libreadline6 libreadline6-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev

Install ruby-build

$ git clone git://github.com/sstephenson/ruby-build.git /tmp/ruby-build
$ cd /tmp/ruby-build/

$ ./install.sh

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 Les-MacBook-Pro.local # added by Apache Friends XAMPP
@laptrinhcomvn
laptrinhcomvn / moving_from_jquery_to_vanilla.md
Last active December 10, 2016 12:16 — forked from liamcurry/gist:2597326
Vanilla JS vs jQuery

Moving from jQuery to Vanilla

Events

// jQuery
$(document).ready(function() {
  // code
})

// Vanilla
<?php
// API access key from Google API's Console; change to cloud messaging tab to get the server token
define( 'API_ACCESS_KEY', 'YOUR_FIREBASE_API_ACCESS_KEY' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
(
'body' => $_GET['body'],
'title' => $_GET['title'],
'vibrate' => 1,
@laptrinhcomvn
laptrinhcomvn / ResourceUtil.java
Created July 16, 2018 17:22 — forked from Gnzlt/ResourceUtil.java
Android utils class to get a Bitmap from a VectorDrawable Resource Id (Took from http://qiita.com/konifar/items/aaff934edbf44e39b04a)
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.VectorDrawable;
import android.os.Build;
import android.support.annotation.DrawableRes;
import android.support.graphics.drawable.VectorDrawableCompat;