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 lowerCase = 'abc'; | |
var upperCase = 'ABC'; | |
var symbols = '*!?'; | |
//make strings array | |
lowerCase = lowerCase.split(''); | |
upperCase = upperCase.split(''); | |
symbols = symbols.split(''); | |
function selectRandom(set){ |
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 Input = pc.createScript('input'); | |
Input.attributes.add('id', { type : 'string' }); | |
Input.attributes.add('autofocus', { type : 'boolean' }); | |
Input.attributes.add('fontSize', { type : 'number' }); | |
Input.attributes.add('padding', { type : 'number' }); | |
Input.attributes.add('margin', { type : 'string' }); | |
Input.attributes.add('type', { type : 'string', | |
enum: [ | |
{ 'Text Input' : 'text' }, |
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 | |
function applyUpdate($diff, $arr1, $arr2){ | |
$status = false; | |
if(count($diff['different']) > 0){ | |
foreach ($diff['different'] as $key => $value) { | |
$exec = '$arr1.'.$value.' = $arr2.'.$value.';'; | |
$exec = preg_replace("/\.(\d{1,3})/", "[$1]", $exec); | |
$exec = preg_replace('/\.(\w*)/', "['$1']", $exec); |
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 campaignImage = { | |
options : { | |
bgOpacity : 0.7, | |
fontFamily : 'Arial, sans-serif', | |
fontSize : 34, | |
textColor : '#fff' | |
}, | |
convert : function(element, text){ | |
var canvas = this.imageToCanvas(element); | |
canvas = this.rectangle(canvas, text); |
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
//Javascript | |
Vue.component('sort', { | |
template: "#sort-template", | |
props : ['data', 'id'], | |
ready: function (value) { | |
Sortable.create(document.getElementById(this.id), { | |
draggable: 'li' | |
}); | |
} | |
}); |
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
function pad(num,size) { | |
var s = "000000000" + num; | |
return s.substr(s.length-size); | |
} | |
var bitLength = 2; //Size of each number | |
var headType = 8; //Min integer in bytes will write in head for index. | |
function bit(val){ |
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 lastEvent;(function($) {$.fn.justClick = function(callback) {this.bind('mousemove mousedown mouseup', function(e) {if(e.type == 'mouseup' && lastEvent == 'mousedown'){callback()}lastEvent = e.type;});}}(jQuery)); | |
$('#obj').justClick(function(){ | |
console.log("Not move, not drag. It is just click!"); | |
}); | |
//Similar threads | |
//http://stackoverflow.com/questions/1572483/jquery-mousedown-mousemove | |
//http://stackoverflow.com/questions/2928161/binding-mousemove-within-mousedown-function-with-jquery |
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
<script> | |
function similarity(val){ | |
var output = 0; | |
for(i=0;i<val.length;i++){ | |
output+=val.charCodeAt(0); | |
} | |
return parseInt(output/val.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
/* | |
You can use it for animations or sequential processes. | |
*/ | |
function sequence(){ | |
var length = arguments.length-1; | |
var delay = arguments[length]; | |
for(i=0;i<length;i++){ | |
setTimeout( |
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 displayDump = Array(); | |
$.fn.hide = function() { | |
var selector = this.selector; | |
displayDump[selector] = Array(); | |
$(this).each(function( index ) { | |
displayDump[selector].push($(selector)[index].innerHTML); | |
$(this).css("display","none").html(""); | |
}); |
NewerOlder