Skip to content

Instantly share code, notes, and snippets.

View uditalias's full-sized avatar
🧙

Udi Talias ⚛️ uditalias

🧙
View GitHub Profile
@uditalias
uditalias / ADHDHelpers.js
Created September 5, 2017 08:02
ADHD module
const ADHDHelpers = (function () {
let module = {
scrollTop: 0,
isDisabled: false,
shouldDisplayScrollbar: false,
@uditalias
uditalias / facebook.js
Created September 4, 2017 19:03
Fetch data from facebook API
var https = require('https');
exports.get = function(accessToken, apiPath, callback) {
// creating options object for the https request
var options = {
// the facebook open graph domain
host: 'graph.facebook.com',
// secured port, for https
port: 443,
@uditalias
uditalias / App.js
Last active February 2, 2017 19:51
Mobx `inject()` + `observe()` in one comfortable function = `mobxify()`
import React, {Component} from 'react'
import {View, Text} from 'react-native'
import {mobxify} from 'utils'
class App extends Component {
render() {
return (
<View>
<Text>mobxify is awesome!</Text>
</View>
@uditalias
uditalias / jQuery.Handlebars.plugin.js
Created January 8, 2013 12:06
A fix to Handlebars jQuery plugin from: http://blog.teamtreehouse.com/handlebars-js-part-3-tips-and-tricks. When using the original plugin, we must load our template from a <script> tag, if we want to load it from a JavaScript variable the problem is that the parent element of our template wont be included in the result. I changed the line: temp…
(function ($) {
var compiled = {};
$.fn.handlebars = function (template, data) {
if (template instanceof jQuery) {
template = $("<div />").append($(template).clone()).html();
}
compiled[template] = Handlebars.compile(template);
this.html(compiled[template](data));
};
})(jQuery);
@uditalias
uditalias / consolelog.override.js
Last active December 9, 2015 19:28
A good way to override the `console.log` function in the browser, Yet preserved the original functionality of the function. In this example I want to send any `console.log` call to my Node.js/Socket.io server.
(function(){
//saving the original console.log function
var preservedConsoleLog = console.log;
//overriding console.log function
console.log = function() {
//we can't just call to `preservedConsoleLog` function,
//that will throw an error (TypeError: Illegal invocation)
//because we need the function to be inside the