Skip to content

Instantly share code, notes, and snippets.

{
"data": {
"deliveries": [
{
"id": "ef7d123e-4517-4d9b-9229-c6d8298bf468",
"eventAt": "2023-12-22T20:15:00Z",
"order": {
"orderNumber": "#TK9-EPR"
},
"status": "accepted"
@faisalhmohd
faisalhmohd / gpt-neo.py
Created June 8, 2021 17:10
Simple GPT-NEO Text Generation Example
# Pre-install Dependencies
# pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
# pip install transformers
from transformers import pipeline
generator = pipeline('text-generation', model='EleutherAI/gpt-neo-2.7B')
article_title = "batman is too strong for superman"
res = generator(prompt, max_length=50, do_sample=True, temperature=0.9) # Play around with the parameters here to vary your output
print(res[0]['generated_text'])
@faisalhmohd
faisalhmohd / flite.js
Created July 8, 2020 10:32
Flite Code
/*!
* Source version: FLITE_VERSION
* Copyright (C) 2018 LoopIndex - All Rights Reserved
* You may use, distribute and modify this code under the
* terms of the LoopIndex Comments CKEditor plugin license.
* Attributions
*
* Rangy library:
* Copyright 2018, Tim Down
* https://github.com/timdown/rangy
@faisalhmohd
faisalhmohd / brainly-solution.js
Created March 4, 2020 11:34
Remove Duplicates
const testData = [
{
"id": 123,
"content": "Content",
"createTimestamp": 123213,
"answers": [
{
"id": 142,
"rating": 10,
"content": "Test answer"
@faisalhmohd
faisalhmohd / index.tsx
Created August 17, 2019 11:06
React Private Router Trial
// THIS FILE IS ONLY FOR REFERENCE.
// IS NOT USED IN ANY PA
import React, { useReducer, useContext } from 'react';
import { Redirect, RouteProps, Route } from 'react-router-dom';
import config from '../config';
import GoogleLogin from './GoogleLogin';
const UserContext = React.createContext({});
@faisalhmohd
faisalhmohd / index.html
Created January 12, 2019 14:30
React v16 Error Boundary Example
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="React v16 Error Boundary Implementation">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<title>JS Bin</title>
</head>
@faisalhmohd
faisalhmohd / index.html
Last active January 12, 2019 13:55
React v16 Context API Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://fb.me/react-with-addons-15.1.0.js"></script>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
</head>
@faisalhmohd
faisalhmohd / keybase.md
Created December 23, 2017 13:44
Keybase Verification

Keybase proof

I hereby claim:

  • I am faisalhmohd on github.
  • I am mohdfaisal (https://keybase.io/mohdfaisal) on keybase.
  • I have a public key ASChfbgE3Ty-C2VsjNu2_H7TWmpMOsWkpiY_j-ScQKBcMAo

To claim this, I am signing this object:

@faisalhmohd
faisalhmohd / fucntions.php
Last active September 24, 2017 08:30
Add a custom menu
<?php
// Custom Menu
add_filter( 'init', 'register_primary_menu');
function register_primary_menu() {
register_nav_menu('nav-primary',__( 'Navigation Primary' ));
}
function custom_primary_menu() {
$menu_name = 'nav-primary';
if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
@faisalhmohd
faisalhmohd / hideNDivs.js
Created October 25, 2016 16:53
Hide child div's dynamically
var hideDivs = [2, 3]; // Enter the divs to be hidden
$( ".div" ).each(function() {
for(var i = 0; i < hideDivs.length; i++){
$(this).find('a:eq(' + hideDivs[i] + ')').hide();
}
});