Skip to content

Instantly share code, notes, and snippets.

Avatar
😳

unclebill UncleBill

😳
  • Haikou, China
View GitHub Profile
View gist:9482014
fun! s:use_eval(co)
let c = a:co
let r = eval('0x'.c[0].c[1])
let g = eval('0x'.c[2].c[3])
let b = eval('0x'.c[4].c[5])
return [r,g,b]
endfunction
fun! s:without_eval(co)
let c = a:co
View gist:25d7b4d962a402e0ac4e
function uniqueAndCount(list) {
var index = 0,
num = 0;
var result = [];
for (var i = 0; i < list.length; i++) {
if ($.inArray(list[i], result) < 0) {
result.push(list[i]);
while ($.inArray(list[i], list, index) > -1) {
num++;
index = $.inArray(list[i], list, index) + 1;
@UncleBill
UncleBill / LICENSE.txt
Created Sep 7, 2012 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
View LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@UncleBill
UncleBill / sort1mb.cpp
Created Oct 28, 2012 — forked from preshing/sort1mb.cpp
Sort one million 8-digit numbers in 1MB RAM
View sort1mb.cpp
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned long long u64;
//-------------------------------------------------------------------------
// WorkArea
//-------------------------------------------------------------------------
@UncleBill
UncleBill / windows.h__.js
Created Nov 18, 2012
windows.h.js INFINITY
View windows.h__.js
var ffi = require('ffi'),
ref = require('ref'),
Struct = require('ref-struct'),
Library = require('./Library'),
Type = ref.Type,
NULL = ref.NULL,
isNull = ref.isNull;
var groups = ['libs', 'types', 'structs', 'callbacks', 'enums'];
View uniqueArr.js
function uniqueArr(arr, juggfunc) {
var resArr = [];
var has = false;
for (var i = 0; i < arr.length; ++i) {
for (var j = 0; j < resArr.length; ++j) {
if( juggfunc(resArr[j], arr[i]) ){
has = true;
}
}
if (has) {
@UncleBill
UncleBill / SwitchyOmega
Created Dec 4, 2015
SwitchyOmega 代理FTP无法下载文件
View SwitchyOmega
PAC script: data:application/x-ns-proxy-autoconfig;base64,LypPbWVnYVByb2ZpbGUqIlx1MDAyZnU4MWVhXHUwMDJmdTUyYThcdTAwMmZ1NTIwN1x1MDAyZnU2MzYyIioxNTBkZGViZTQ1NyovdmFyIEZpbmRQcm94eUZvclVSTD1mdW5jdGlvbihpbml0LHByb2ZpbGVzKXtyZXR1cm4gZnVuY3Rpb24odXJsLGhvc3QpeyJ1c2Ugc3RyaWN0Ijt2YXIgcmVzdWx0PWluaXQsc2NoZW1lPXVybC5zdWJzdHIoMCx1cmwuaW5kZXhPZigiOiIpKTtkb3tyZXN1bHQ9cHJvZmlsZXNbcmVzdWx0XTtpZih0eXBlb2YgcmVzdWx0PT09ImZ1bmN0aW9uIilyZXN1bHQ9cmVzdWx0KHVybCxob3N0LHNjaGVtZSl9d2hpbGUodHlwZW9mIHJlc3VsdCE9PSJzdHJpbmcifHxyZXN1bHQuY2hhckNvZGVBdCgwKT09PTQzKTtyZXR1cm4gcmVzdWx0fX0oIitcdTgxZWFcdTUyYThcdTUyMDdcdTYzNjIiLHsiK1x1ODFlYVx1NTJhOFx1NTIwN1x1NjM2MiI6ZnVuY3Rpb24odXJsLGhvc3Qsc2NoZW1lKXsidXNlIHN0cmljdCI7aWYoL15odHRwczpcL1wvLipcLmNsb3VkZnJvbnRcLm5ldFwvLy50ZXN0KHVybCkpcmV0dXJuIitzaGFkb3dzb2NrcyI7aWYoL15mZWVkbHlcLmNvbSQvLnRlc3QoaG9zdCkpcmV0dXJuIitzaGFkb3dzb2NrcyI7aWYoL15tYWlsXC5nb29nbGVcLmNvbSQvLnRlc3QoaG9zdCkpcmV0dXJuIitzaGFkb3dzb2NrcyI7aWYoL153d3dcLmdvb2dsZVwuY29tJC8udGVzdChob3N0KSlyZXR1cm4iK3NoYWRvd3NvY2tzIjtpZigvXmNvZGVcLmdvb2dsZVwuY2
View sdcv.vim
" unclebill <billbill290@gmail.com>
function! Sdcv(...)
let s:keyword = ""
if a:0 == 0
let s:keyword = expand("<cword>")
if s:keyword == ""
echo "sdcv: no keyword input"
return
endif
else
View gist:5764320
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css" media="screen">
.box{
height:30px;
width:30px;
border-radius:30px;
View zone-pgm-rainbow
;; zone-pgm-rainbow
(defun decimal->hex (n)
(format "%02X" n))
(defun hsv->rgb (h s v)
(let ((h (max 0 (min 360 h)))
(s (/ (max 0 (min 100 s)) 100.0))
(v (/ (max 0 (min 100 v)) 100.0)))
(if (= 0 s)
You can’t perform that action at this time.