This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/questions/4570333/string-compression-in-javascript | |
function en(c){var x='charCodeAt',b,e={},f=c.split(""),d=[],a=f[0],g=256;for(b=1;b<f.length;b++)c=f[b],null!=e[a+c]?a+=c:(d.push(1<a.length?e[a]:a[x](0)),e[a+c]=g,g++,a=c);d.push(1<a.length?e[a]:a[x](0));for(b=0;b<d.length;b++)d[b]=String.fromCharCode(d[b]);return d.join("")} | |
function de(b){var a,e={},d=b.split(""),c=f=d[0],g=[c],h=o=256;for(b=1;b<d.length;b++)a=d[b].charCodeAt(0),a=h>a?d[b]:e[a]?e[a]:f+c,g.push(a),c=a.charAt(0),e[o]=f+c,o++,f=a;return g.join("")} | |
var compressed=en("http://www.ScriptCompress.com - Simple Packer/Minify/Compress JavaScript Minify, Fixify & Prettify 75 JS Obfuscators In 1 App 25 JS Compressors (Gzip, Bzip, LZMA, etc) PHP, HTML & JS Packers In 1 App PHP Source Code Packers Text Packer HTML Packer or v2 or v3 or LZW Twitter Compress or More Words DNA & Base64 Packer (freq tool) or v2 JS JavaScript Code Golfer Encode Between Quotes Decode Almost Anything Password Protect Scripts HTML Minifier v2 or En |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sum Numbers over an array | |
const sum = array => array.reduce((acum, number) => { | |
return acum + number; | |
}, 0); | |
console.log('01', { sum: sum([ 1, 5, 9 ]) }); | |
// Sum Numbers multiplied by a factor | |
const sumProduct = array => array.reduce((acum, pair) => { | |
const [ number, factor ] = pair; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from 'react'; | |
// this func do not cover all the cases | |
function debounce(func, wait = 100) { | |
let timeout; | |
return function(...args) { | |
clearTimeout(timeout); | |
timeout = setTimeout(() => { | |
func.apply(this, args); | |
}, wait); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Incognito by David Eagleman | |
2. How Smart Machines Think by Sean Gerrish | |
3. The Hundred-Page Machine Learning Book by Andriy Burkov | |
4. Python Machine Learning (2nd Edition) by Sebastian Rasckha & Vahid Mirjalili | |
5. Deep Learning by Andrew W. Trask | |
6. Bayesian Methods For Hackers by Cameron Davidson - Pilon | |
7. Doing Data Science by Cathy O'Neil & Rachel Schutt | |
8. Reinforcement Learning by Richard S. Sutton & Andrew G. Barto | |
9. The Book of Why by Judea Pearl & Dana Mackenzie | |
10. Quantum Machine Learning by Peter Wittek |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Date object to unix timestamp | |
function unix(date) { | |
return Math.round(date.getTime() / 1000); | |
} | |
// replace all from string | |
String.prototype.replaceAll = function(rgx, replacement) { | |
var self = this; | |
return self.replace(new RegExp(rgx, "g"), replacement); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFakeProfiles(){ | |
return fetch('https://randomuser.me/api') | |
.then(res => res.json()) | |
.then(res =>res['results'][0]) | |
.catch(e => e); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_POST['email'])) { | |
$email = $_POST['email']; | |
$template = strtr("{\"email_address\": \"%email%\",\"status\": \"subscribed\"}", | |
array('%email%' => $email)); | |
$curl = curl_init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin | |
from time import localtime, strftime | |
class InsertDatetimeCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
format = "%d/%b/%Y/(%I.%M:%p)" | |
current_date = strftime(format, localtime()) | |
content = "Author: Aamir khan (aamirkhan180@gmail.com)\n{}\n".format(current_date) | |
sel = self.view.sel(); | |
for s in sel: | |
if s.empty(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
// const | |
#define AtBeginning 1 | |
#define AtEnd 0 | |
struct Node | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class DecimalToBinary { | |
public static void main(String[] args) { | |
new DecimalToBinary().run(); | |
} | |
public void toDecimal(int number){ | |
int binary[] = new int[number]; |