Skip to content

Instantly share code, notes, and snippets.

View yangjunjun's full-sized avatar
🐱
Focusing

杨军军 yangjunjun

🐱
Focusing
  • undefined
  • Xian, Shaanxi, China
View GitHub Profile
@yangjunjun
yangjunjun / require.a.js
Last active February 12, 2024 00:07
SeaJS与RequireJS的区别
define('a', function(){
console.log('module a parse ...');
return {
a: function(){
console.log('module a execute ...');
}
}
})
@yangjunjun
yangjunjun / For Mac 4.2.6 unlimited trial.md
Created March 17, 2023 06:29 — forked from rise-worlds/For Mac 4.2.6 unlimited trial.md
Beyond Compare 4 license for Windows, Mac, Linux

for 4.2.4 or higher, 4.2.5,4.2.6,4.3.7, it's works, this is the way which makes Always in evaluation mode.

  1. open Terminal, go to the dir : cd /Applications/Beyond Compare.app/Contents/MacOS
  2. change the name BCompare to BCompare.bak: mv BCompare BCompare.bak
  3. touch a file name BCompare , and chmod a+u BCompare : touch BCompare && chmod a+u BCompare
  4. open BCompare with text editor, insert the script :
#!/bin/bash
rm "/Users/$(whoami)/Library/Application Support/Beyond Compare/registry.dat"
"`dirname "$0"`"/BCompare.bak $@
@yangjunjun
yangjunjun / lookup.js
Created November 27, 2013 02:04
有道的划词查词
/**
* @author Dongxu Huang \ shuke
*/
var isAlpha = function(str) {
return/[a-zA-Z']+/.test(str)
};
document.addEventListener("mousemove", update_mouse_pos, true);
document.addEventListener("mouseup", on_mouse_up, true);
document.addEventListener("mousedown", on_mouse_down, true);
@yangjunjun
yangjunjun / verifyPassword.js
Created October 25, 2013 08:18
测试密码强度
/**
* 测试密码强度
*
* 1.密码长度为[6-16]位,可以包含数字、字母、特殊符号
* 2.当密码含有一种类型(数字、字母、特殊符号),且长度小于8时,强度为弱;长度大于8时强度为中;
* 3.当密码含有一种类型(数字、字母、特殊符号),且长度小于8时,强度为弱;长度大于8时强度为中;
*/
function verifyPassword(val){
val = val.trim();
@yangjunjun
yangjunjun / ClassDefination.js
Last active January 2, 2016 19:39
JS定义一个拥有私用属性的类,就是这个属性“只能”这个类的实例的方法能操作。
/**************************************************************
* Dog相当一个命名空间,不能够产生实例
**************************************************************/
var Dog = {
name: '',
getName: function(){
return this.name;
},
setName: function(name){
this.name = name;
@yangjunjun
yangjunjun / jQuerySnippet.js
Last active December 31, 2015 14:29
一些 jQuery代码片段。
//禁止右键菜单
$(document).bind("contextmenu", function(){
return false;
});
//捕获回车事件
$(document).keydown(function(event){
if(event.keyCode==13){
console.log('Enter ');
}
});
@yangjunjun
yangjunjun / regexSnippet.js
Last active December 31, 2015 14:29
一些正则表达式片段
//过滤html标签
'<a href="#" id="test"><span>test text</a></span>'.replace(/<.*?>/g, '') // 返回'test text'
//获取后缀名(有问题)
'eoopen.apply.file.jpeg'.match(/.[^.]+$/); // ok, 返回 [".jpeg"]
'eoopen-apply-file-jpeg'.match(/.[^.]+$/); // error,返回 ["eoopen-apply-file-jpeg"]
'eoopen-apply-file-jpeg.'.match(/.[^.]+$/); // error,返回 null
var pattern = /java/ig;
var text = 'Java is more fun than javascript!';
@yangjunjun
yangjunjun / getStr.js
Created December 6, 2013 05:58
获取指定个数字符串(汉字字符长度为2)
function getStr(str, len){
var len = 0;
for (var i=0; i<str.length; i++) {
var c = str.charCodeAt(i);
if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) {
len++;
}
else {
len+=2;
}
/*
* @Author: xngiser
* @Date: 2013-11-28 10:50:04
* @Email: ggiiss@qq.com
* @Last Modified by: xngiser
* @Last Modified time: 2013-11-29 21:32:48
*/
(function(window, $, eo){
/***********************************************************************
@yangjunjun
yangjunjun / getSuffixIcon.js
Created November 27, 2013 10:19
根据不同的后缀名,返回相应的后缀类别。
var getSuffixIcon = function(type){
var icon ='unknow';
var suffix = {
image:['jpg','png','gif','jpeg'],
doc:['doc','docx'],
rar:['rar','zip','tar','gz','7z','tar.gz'],
xls:['csv','xls']
}
for(var k in suffix){
if($.inArray(type, suffix[k]) > -1){