Skip to content

Instantly share code, notes, and snippets.

View binaryfunt's full-sized avatar

Ronnie Dutta binaryfunt

  • 19:31 (UTC +01:00)
View GitHub Profile
@kcrt
kcrt / erf.js
Last active May 21, 2018 21:27
simple implementation of mathematic function erf "Error function", in JavaScript JavaScriptによる誤差関数の実装
function erf(x){
// erf(x) = 2/sqrt(pi) * integrate(from=0, to=x, e^-(t^2) ) dt
// with using Taylor expansion,
// = 2/sqrt(pi) * sigma(n=0 to +inf, ((-1)^n * x^(2n+1))/(n! * (2n+1)))
// calculationg n=0 to 50 bellow (note that inside sigma equals x when n = 0, and 50 may be enough)
var m = 1.00;
var s = 1.00;
var sum = x * 1.0;
for(var i = 1; i < 50; i++){
m *= i;
@hendrik-goebel
hendrik-goebel / gist:949c744ae0e789ce28b7
Created May 26, 2014 15:39
PHP: Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);
@fornarat
fornarat / Shuffle.js
Created October 9, 2015 22:24
Fisher-Yates (aka Knuth) Shuffle
function shuffle(array) {
var currentIndex = array.length
, temporaryValue
, randomIndex;
// While there remain elements to shuffle...
while(0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
@phamquocbuu
phamquocbuu / Using Git to Manage a Live Web Site.md
Last active September 24, 2017 20:04 — forked from Nilpo/Using Git to Manage a Live Web Site.md
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@Zemnmez
Zemnmez / tweetdeck-limit-override-dm-rt-fix.js
Last active March 13, 2023 15:21
tweetdeck-limit-override.js
/*
This snippet is esssentially the same as being in the Twitter longer tweets test, for tweetdeck.
The Tweet length counter is fixed by tricking TweetDeck into counting up to 140 characters, twice, so you'll see 140
instead of 280 in the counter but going over 140 will give you another set of 140 charactrs.
*/
TD.services.TwitterClient.prototype.makeTwitterCall=function(b,e,f,g,c,d,h){c=c||function(){};d=d||function(){};b=this.request(b,{method:f,params:Object.assign(e,{weighted_character_count:!0}),processor:g,feedType:h});return b.addCallbacks(function(a){c(a.data)},function(a){d(a.req,"",a.msg,a.req.errors)}),b};
twttrTxt=Object.assign({},twttr.txt,{isInvalidTweet:function(){return!1},getTweetLength:function(x){return x=twttr.txt.getTweetLength.apply(this,arguments),x<140||x/140>2?x:x%140}});