Skip to content

Instantly share code, notes, and snippets.

View arjunu's full-sized avatar
:shipit:

Arjun Umesha arjunu

:shipit:
View GitHub Profile
@GiacoCorsiglia
GiacoCorsiglia / mathjax-in-react.md
Last active June 10, 2024 16:38
Using MathJax v3 in React

Using MathJax v3 in React

Any improvements or alternative approaches are welcome!

One alternative approach can be found in the CharlieMcVicker/mathjax-react library.

Loading MathJax

It may be possible to bundle MathJax with the rest of your JavaScript, which might have the nice consequence of allowing you to import it instead of using the global MathJax object. But I found it simpler to include the following at the bottom of my html file; this is the common way to load MathJax.

@franzdumfart
franzdumfart / .stylelintrc
Created May 12, 2017 12:15
stylelint config inspired by the Airbnb css style-guide
{
"rules": {
"selector-no-id": true,
"indentation": 2,
"selector-list-comma-newline-after": "always",
"declaration-colon-space-after": "always",
"declaration-colon-space-before": "never",
"block-opening-brace-space-before": "always",
"declaration-block-single-line-max-declarations": 1,
node_modules
@royteusink
royteusink / change-sequence.js
Last active October 7, 2020 06:32
immutable.js - Move item in List to a specific location (change sequence, reorder)
if (action.toindex < 0) return state;
var olditem = state.get(action.index);
var newlist = state.delete(action.index).insert(action.toindex, olditem);
return newlist;
anonymous
anonymous / malicious_snippet.js
Created March 22, 2016 19:10
// The first line doesn't look good, but after looking through the entire script, we can see that it's just random snippets from the jQuery source code
// I have removed all the subsequent smokescreens for brevity
iAIzcLGbNj = " while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { if ( elem.nodeType === 1 ) { if ( truncate && jQuery( elem ).is( until ) ) { break; } matched.push( elem ); } } return matched; };";
// Sets an index
fergusI = 0;
// Creates a function that returns the first character of anystring
String.prototype.contradistinction = function () { return this.substr(0, 1); };
// Whenever you have ("collection", "of", "strings") inside parathesis like this, the last string is always returned
// so the first group of ("characteristically","major","n") returns "n"
// This line equates to:
@jasonswearingen
jasonswearingen / redux-simple-router-example.tsx
Last active October 31, 2017 19:37
A simplified example of redux + redux-simple-router using Typescript
/**
WHAT: A very simple example of redux + redux-simple-router using Typescript.
WHY: The official example found here: https://github.com/rackt/redux-simple-router/tree/1.0.2/examples/basic has problems:
1) it is spread over many files making it very hard to "skim"
2) it is organized by function, not by feature. (Example: learning "how to manipulate redux state" is spread over 5 files in 4 folders)
3) there are no comments explaining what's going on/why.
WHO: by JasonS@Novaleaf.com
@frederickfogerty
frederickfogerty / server.js
Created November 17, 2015 21:52
HTML5 History API with webpack-dev-middleware
const _ = require('lodash')
const path = require('path')
const express = require('express')
const webpack = require('webpack')
const config = require('./webpack.dev.config')
const app = express()
const compiler = webpack(config)
var devMiddleware = require('webpack-dev-middleware')(compiler, {
function isValidType( type, value ) {
function getType( item ) {
return Object.prototype.toString.call( item ).slice( 8, -1 );
}
function checkPrimitiveType( type, value ) {
return type == getType( value );
}
@gregkorossy
gregkorossy / VisionApiFocusFix.java
Last active November 22, 2019 11:38
Mobile Vision API fix for missing autofocus feature
/*
* IF YOU WANT TO JUST ACCESS THE CAMERA INSTANCE SO THAT YOU CAN SET ANY OF THE PARAMETERS, VISIT THE FOLLOWING LINK:
* https://gist.github.com/Gericop/364dd12b105fdc28a0b6
*/
/**
* Custom annotation to allow only valid focus modes.
*/
@StringDef({
Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE,
@revolunet
revolunet / python-es6-comparison.md
Last active April 22, 2024 19:22
# Python VS JavaScript ES6 syntax comparison

Python VS ES6 syntax comparison

Python syntax here : 2.7 - online REPL

Javascript ES6 via Babel transpilation - online REPL

Imports

import math