This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open the file | |
Click CTRL + F | |
Select "Current document" in "Find in" (You can also select the folder if you have multiple files) | |
Search in "Source code" | |
Tick "Use regular expression" | |
Type "[\r\n]{2,}" (without quotes) in "Find" | |
Type "\n" (without quotes) in "Replace" | |
Press "Replace All" | |
//This removes all blank lines in Dreamweaver. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FirebasePlayerMatchMaker { | |
public static interface OnMatchMadeCallback { | |
public void run(FirebasePlayerMatchMaker c); | |
} | |
public static final String RANDOM_ROOM_ID = "/Globl"; | |
public static final String ROOM_ID = "/GameRooms"; | |
public static final String GAMES_RECORD = "/OpenGameMoves"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var crypto = require("crypto"); | |
var EncryptionHelper = (function () { | |
function getKeyAndIV(key, callback) { | |
crypto.pseudoRandomBytes(16, function (err, ivBuffer) { | |
var keyBuffer = (key instanceof Buffer) ? key : new Buffer(key) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Google Play API Key | |
// ref: http://stackoverflow.com/questions/35127086/android-inapp-purchase-receipt-validation-google-play | |
// ref: https://developers.google.com/android-publisher/authorization | |
// ref: http://google.github.io/google-api-nodejs-client/18.0.0/index.html#toc14__anchor | |
// | |
// install npm package | |
// ref: https://github.com/google/google-api-nodejs-client | |
// $ npm install googleapis --save | |
// | |
const google = require('googleapis'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// time and time end | |
console.time("This"); | |
let total = 0; | |
for (let j = 0; j < 10000; j++) { | |
total += j | |
} | |
console.log("Result", total); | |
console.timeEnd("This"); | |
// Memory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// number to string, pluginized from http://stackoverflow.com/questions/5529934/javascript-numbers-to-words | |
window.num2str = function (num) { | |
return window.num2str.convert(num); | |
} | |
window.num2str.ones=['','one','two','three','four','five','six','seven','eight','nine']; | |
window.num2str.tens=['','','twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety']; | |
window.num2str.teens=['ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Requirements: jQuery | |
// Installation: Add this to your tinyMCE.init, put in your button image and your Embed.ly key and you're good to go | |
// This is just a very simple embed.ly button cause Google turned up squat. | |
setup : function(ed) { | |
ed.addButton('myembedly', { | |
title : 'Embed.ly', | |
image : 'BUTTON IMAGE', | |
onclick : function() { | |
var url = prompt("Enter URL to embed"); | |
if (url == null) return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Validate if a Unix timestamp is valid. | |
* | |
* @param $unixtimestamp | |
* @return bool | |
*/ | |
function datetime_IsUnixTimeStampValid($unixtimestamp) { | |
// | |
// | |
/////////////////////////////////////////////////////////////////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Str; | |
function generateReferralCode($str) { | |
// get random number min & max 4 digit | |
$randomNumber = rand(1000, 9999); | |
// get the first 4 character and trim whitespace | |
$strName = trim(substr($str, 0, 4)); | |
// get str length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require("crypto") | |
function encrypt(key, data) { | |
var cipher = crypto.createCipher('aes-256-cbc', key); | |
var crypted = cipher.update(data, 'utf-8', 'hex'); | |
crypted += cipher.final('hex'); | |
return crypted; | |
} |
OlderNewer