Skip to content

Instantly share code, notes, and snippets.

View elado's full-sized avatar
👨‍💻

Elad Ossadon elado

👨‍💻
View GitHub Profile
@elado
elado / stop-gifs.js
Last active November 8, 2018 09:19
STOP ALL GIFS!!!!!! (bookmarklet)
javascript:(function(){function createElement(a,b){var c=document.createElement(a);return b(c),c}function f(a){var e,b=a.width,c=a.height,d=createElement("canvas",function(a){a.width=b,a.height=c}),f=0,g=function(){for(d.getContext("2d").drawImage(a,0,0,b,c),f=0;f<a.attributes.length;f++)e=a.attributes[f],'"'!==e.name&&d.setAttribute(e.name,e.value);d.style.position="absolute",a.parentNode.insertBefore(d,a),a.style.opacity=0};a.complete?g():a.addEventListener("load",g,!0)}function all(){return(new Array).slice.apply(document.images).map(f)}all();})()
@elado
elado / V++.js
Created November 19, 2015 18:26
V++: Video Speed Controller Bookmarklet
javascript:r=+prompt('speed',%20'1.5');[].slice.apply(document.querySelectorAll('video,audio')).forEach(function(v){v.playbackRate=r});void(0);
@elado
elado / x.md
Last active January 10, 2018 19:51
x.md
Summary Goes Here
```js
const test = 1
```
@elado
elado / _arrow-mixin.scss
Created July 25, 2017 18:55
SCSS/SASS Arrow Mixin
@mixin arrow-helper($arrow-size, $arrow-color, $margin, $offset, $side, $align) {
@if $side == 'top' {
border-bottom-color: $arrow-color;
top: -2 * $arrow-size;
}
@if $side == 'bottom' {
border-top-color: $arrow-color;
bottom: -2 * $arrow-size;
}
@elado
elado / cryptocurrency.js
Created May 26, 2017 00:48
cryptocurrency.js
let valueInUSD = 1
setInterval(() => {
valueInUSD = Math.max(valueInUSD + (Math.random() >= 0.5 ? 1 : -1) * Math.random() / (5 * Math.random()), 0.1)
console.log('valueInUSD', valueInUSD)
}, 10)
@elado
elado / node-proxy-https-to-http.js
Created May 10, 2017 22:18
Node Proxy from HTTPS to HTTP + CORS
// DO NOT USE IN PRODUCTION.. OBVIOUSLY.
const http = require('http')
const httpProxy = require('http-proxy')
const { argv } = require('yargs')
const proxy = httpProxy.createProxyServer()
proxy.on('error', e => console.log('error', e))
@elado
elado / CaseChange.js
Last active February 28, 2017 17:59
CaseChange (object deep camelizer/underscorer)
import _ from 'lodash'
const CaseChange = {
camelizeKey: _.memoize(_.camelCase),
underscoreKey: _.memoize(_.snakeCase),
convertToCamelcase(object) {
return deepMapKeys(object, CaseChange.camelizeKey)
},
@elado
elado / AngularBaseCtrl.coffee
Last active January 28, 2017 08:43
Angular.js CoffeeScript Controller Base Class
# dependency - Function.prototype.bind or underscore/lodash
app = angular.module 'someApp'
class @BaseCtrl
@register: (app, name) ->
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1]
app.controller name, @
@inject: (args...) ->
function urlEncodedTaggedString(strings, ...substitutions) {
let result = strings[0]
for (let i = 0; i < substitutions.length; ++i) {
result += encodeURIComponent(substitutions[i])
result += strings[i + 1]
}
return result
}
let name = 'I have ? and #!'
@elado
elado / mobxStoresToProps.js
Created October 18, 2016 19:50
mobxStoresToProps
import React, { Component } from 'react'
import { omit } from 'lodash-bound'
import { observer, inject } from 'mobx-react'
// usage:
//
// @mobxStoresToProps(['entityStore', 'userStore'], (entityStore, userStore, { conversationId }) => {
// const conversation = entityStore.conversation.getById(conversationId)
// const user = conversation.counterParty