Skip to content

Instantly share code, notes, and snippets.

:octocat:
Indefinitely In Bangkok

Chad Scira icodeforlove

:octocat:
Indefinitely In Bangkok
Block or report user

Report or block icodeforlove

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@icodeforlove
icodeforlove / ResizeHandle.js
Created Apr 15, 2019
Custom window resize handle for nw.js
View ResizeHandle.js
import React, { useState, useEffect } from 'react';
const {
resizeWindowTo
} = nw.global;
function ResizeHandle () {
let timeout,
startW,
startH,
@icodeforlove
icodeforlove / worker.js
Last active May 31, 2018
GDPR Block All European Countries (Cloudflare Worker)
View worker.js
const BLOCKED_COUNTRIES = [
'AL', 'AD', 'AM', 'AT', 'BY', 'BE', 'BA', 'BG', 'CH', 'CY', 'CZ', 'DE',
'DK', 'EE', 'ES', 'FO', 'FI', 'FR', 'GB', 'GE', 'GI', 'GR', 'HU', 'HR',
'IE', 'IS', 'IT', 'LT', 'LU', 'LV', 'MC', 'MK', 'MT', 'NO', 'NL', 'PL',
'PT', 'RO', 'RU', 'SE', 'SI', 'SK', 'SM', 'TR', 'UA', 'VA'
];
addEventListener('fetch', event => {
event.respondWith((async request => {
let country = request.headers.get('CF-IpCountry'),
View keybase.md

Keybase proof

I hereby claim:

  • I am icodeforlove on github.
  • I am icodeforlove (https://keybase.io/icodeforlove) on keybase.
  • I have a public key ASCiKauZxmftV2AKdSE2hZh4cpakK0fdE8yx7A-zCMZWiQo

To claim this, I am signing this object:

@icodeforlove
icodeforlove / java to smali.sh
Created Dec 9, 2016
commands to see java converted into smali
View java to smali.sh
javac -source 1.7 -target 1.7 HelloWorld.java
sudo dx --dex --output=classes.dex HelloWorld.class
java -jar ~/bin/baksmali.jar disassemble classes.dex
@icodeforlove
icodeforlove / generateTK.js
Created Nov 22, 2016
Generate the tk for signing the google translate payload
View generateTK.js
var generateTK = (function () {
function b(a, b) {
for (var d = 0; d < b.length - 2; d += 3) {
var c = b.charAt(d + 2),
c = 'a' <= c ? c.charCodeAt(0) - 87 : Number(c),
c = '+' == b.charAt(d + 1) ? a >>> c : a << c;
a = '+' == b.charAt(d) ? a + c & 4294967295 : a ^ c;
}
View OVH-JBOD.sh
# LSI doesnt support JBOD, but what we can do is set each drive as raid0 and enable caching
MegaCli -CfgLdAdd -r0[252:0] WB RA Cached CachedBadBBU -strpsz512 -a0
MegaCli -CfgLdAdd -r0[252:1] WB RA Cached CachedBadBBU -strpsz512 -a0
MegaCli -CfgLdAdd -r0[252:2] WB RA Cached CachedBadBBU -strpsz512 -a0
MegaCli -CfgLdAdd -r0[252:3] WB RA Cached CachedBadBBU -strpsz512 -a0
View task.0.0.17.js
/*! task.js - 0.0.17 - clientside/minified */
var task=function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var i=r(1),o=n(i),s=r(3),a=n(s),u=r(4),l=n(u),c={maxWorkers:navigator.hardwareConcurrency},f=r((0,o["default"])()?5:7);t.exports=new a["default"](c,f),t.exports.defaults=(0,l["default"])(c,f,a["default"])},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var i=r(2),o=n(i);t.exports=function(){if("undefined"!=typeof Worker&&(window.URL||window.webkitURL))try{var t=new Worker((0,o["default"])(function(){}));return t.terminate(),!0}catch(e){}return!1}},function(t,e){"use strict";t.exports=function(t){var e,r=t.toString();r=r.substring(r.indexOf("{")+1,r.lastIndexOf("}"));try{e=new Blob([r],{type:"text/javascript"})}catch(n){window.BlobBuilder=window.
@icodeforlove
icodeforlove / Float32Array.concat.js
Last active Jul 14, 2016
Float32Array concatenation uses buffers
View Float32Array.concat.js
Float32Array.prototype.concat = function() {
var bytesPerIndex = 4,
buffers = Array.prototype.slice.call(arguments);
// add self
buffers.unshift(this);
buffers = buffers.map(function (item) {
if (item instanceof Float32Array) {
return item.buffer;
@icodeforlove
icodeforlove / Easing.js
Last active Jun 18, 2016
nice set of easing javascript functions
View Easing.js
function EasingClamp (func) {
return function (k) {
k = Math.min(Math.max(func(k), 0), 1);
return isNaN(k) ? 0 : k;
};
}
var Easing = {
Linear: {
None: EasingClamp(function (k) {
return k;
View .webpack-dev-server-delay.js
// add a delay to webpack-dev-server
(function () {
var Server = require('webpack-dev-server/lib/Server'),
sendStats = Server.prototype._sendStats,
delay = 75;
Server.prototype._sendStats = function () {
var args = arguments,
self = this;
You can’t perform that action at this time.