Skip to content

Instantly share code, notes, and snippets.

@Dzinlife
Dzinlife / *.js
Last active March 12, 2020 17:58
Surge Script - Jellow Display User Followed Status
//URL regexp
\/\/api\.jellow\.club\/1\.0\/users\/profile
if (!follewedList) {
var follewedList = new Set()
}
(($request, $response, $done) => {
const JELLOW_ID = 'YOUR_JELLOW_ID'
const requestUrl = $request.url
const params = {}
query.replace(/([^=?#&]*)=([^?#&]*)/g, function(e, $1, $2) {
params[decodeURIComponent($1)] = decodeURIComponent($2)
})
@Dzinlife
Dzinlife / gist:29ba6265842a7dc02f5919fdae3e884e
Created December 7, 2017 10:02
use ImageMagick to generate semi-transparent favicon.ico
convert transparent-img1.png transparent-img2.png transparent-img3.png -channel Alpha favicon.ico
I think you should tranfer image in base64 to image with blob, because when you use base64 image, it take a lot of log lines or a lot of line will send to server. With blob, it only the file. You can use this code bellow:
dataURLtoBlob = (dataURL) ->
# Decode the dataURL
binary = atob(dataURL.split(',')[1])
# Create 8-bit unsigned array
array = []
i = 0
while i < binary.length
array.push binary.charCodeAt(i)
var n = 9
var r = n/2
function range(i){
var left = -r + i
var right = -r + i + 1
if( left < - r ){
left = -r
}
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="./css/index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#enzan").click( function() {
var a = $("#start").val();
function randomArray(array){
function swap(obj, a, b) {
var tmp = obj[a];
obj[a] = obj[b];
obj[b] = tmp;
}
var length = array.length;
var rand = function(){
return Math.round(Math.random() * (length - 1));
define(('__proto__' in {} ? ['zepto'] : ['jquery']), function($) {
return $;
});
var clickOrTouch = (('ontouchend' in window)) ? 'touchend' : 'click';
$('#element').on(clickOrTouch, function() {
// do something
});
@Dzinlife
Dzinlife / gist:0eb9b949e698d23ae19d
Last active November 5, 2017 09:26
Low pass filter
const double ALPHA = 0.05;
resultSpeed = ALPHA * currentSpeed + (1.0 - ALPHA) * resultSpeed;