Skip to content

Instantly share code, notes, and snippets.

@jozsefs
jozsefs / SassMeister-input.scss
Last active August 29, 2015 14:14
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
@mixin keyframes($animationName) {
@-webkit-keyframes #{$animationName} {
$browser: '-webkit-'; @content;
}
@-moz-keyframes #{$animationName} {
@jozsefs
jozsefs / introrx.md
Last active August 29, 2015 14:21 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@jozsefs
jozsefs / gulpfile.js
Last active August 29, 2015 14:23
Gulpfile - Babel, watchify, livereload
//npm install gulp gulp-connect gulp-util vinyl-source-stream vinyl-buffer lodash.assign babelify watchify browserify --save-dev
var watchify = require('watchify');
var browserify = require('browserify');
var babel = require('babelify');
var gulp = require('gulp');
var connect = require('gulp-connect');
var gutil = require('gulp-util');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
@jozsefs
jozsefs / correct.js
Last active August 29, 2015 14:23 — forked from benjamingr/correct.js
function createUser(username, callback) {
var connection = DatabaseClient.connect();
var users = connection.call('collection', 'users');
var query = users.call('query', {username: username});
return query.then(function(existing){
if(existing) throw new Error("User already exists: " + username);
else return users.call('create', {username: username});
}).fin(function(connection){ return connection.call('close'); });
}
@jozsefs
jozsefs / rotateArray.js
Created June 26, 2015 07:21
Rotates an array
function rotate(arr, num) {
num = num % arr.length;
return arr.slice(num).concat(arr.slice(0, num))
}
export default rotate;
@jozsefs
jozsefs / jslinelength.sh
Last active August 29, 2015 14:25
Get each js files line length in a folder (ignoring node_modules)
find ./ -type f -name "*.js" -not -path "*/node_modules/*" -print0 | xargs -0 wc -l | sort -n >> files.txt
@jozsefs
jozsefs / renameJsFiles.sh
Last active April 19, 2016 19:50
Renames all .js files to end with .babel.js in the directory and subdirectories
for i in `find . -iname "*.js"`; do a=$(basename $i .js); echo mv $i $a.babel.js; done
@jozsefs
jozsefs / gist:d39abdb6012ede15d0eb
Created January 31, 2016 22:14 — forked from bdalziel/gist:2293724
Work around for iOS iframe growth
html,
body,
#doc {
height: 100%; // Passes through the height of the parent iframe element
}
#doc {
// Magic to prevent iOS growing the iFrame to fit the content.
// This container will mimic the behavior of the iframe on a desktop browser
-webkit-overflow-scrolling:touch;
overflow-y: scroll;
@jozsefs
jozsefs / redis-dump-keys.sh
Last active July 13, 2024 10:47
dump redis keys with value (human readable values, not using the DUMP from redis). TBH if you have 10k+ keys this will take a lot of time
redis-cli keys \* | while read key; do value="`redis-cli get "$key"`"; echo "$key: $value"; done
@jozsefs
jozsefs / youtube-videos-sorter.js
Last active October 5, 2017 06:45
Sort youtube videos by views - channel videos or searched videos
(() => {
const channelVideosGrid = document.querySelector('[page-subtype=channels] #items');
const grid = channelVideosGrid;
const MULTIPLIER = {
k: 1000,
m: 1000 * 1000,
b: 1000 * 1000 * 1000
};
if (!grid) {