Skip to content

Instantly share code, notes, and snippets.

View FireZenk's full-sized avatar
🌍
Improving the world

Jorge Garrido FireZenk

🌍
Improving the world
View GitHub Profile
@paularmstrong
paularmstrong / media-queries.less
Created July 11, 2012 16:38
Media Query variables in LESS
@mq-phone: ~'(max-width: 767px)';
@mq-tablet: ~'(min-width: 768px) and (max-width: 979px)';
@mq-desktop: ~'(min-width: 980px)';
@mq-dpi-2: ~'(-webkit-min-device-pixel-ratio: 2)';
@media @mq-phone {
// styles for phone
}
@media @mq-tablet {
@xiprox
xiprox / make_drawable_configuration.sh
Last active November 4, 2015 13:55
Android Drawable Animation Configuration Generator – A simple script for easily creating configuration xml files for drawable animations in android
#!/bin/bash
SCRIPT_CONFIGURED=false # CHANGE THIS TO TRUE ONCE YOU MAKE YOUR CHANGES
DRAWABLE_NAME="rocket_animation" # Name of final drawable
FRAME_PREFIX="rocket_animation_" # Prefix in the names of each frame under your res/drawable folder
FRAME_NUMBER=100 # Number of frames the animation has
FRAME_DURATION=200 # Duration of a single frame (in milliseconds)
ONESHOT="false" # Animation plays only once if this is set true
@LaudemPax
LaudemPax / QuadTree.java
Created March 16, 2013 02:44
My Quadtree
public class Quadtree {
//maximum entities in each sector
private int MAX_ENT = 10;
//maximum number of levels
private int MAX_LEVELS = 5;
private int level;
private Array<Entity> collideEntities;
@kcrwfrd
kcrwfrd / Overview.md
Last active June 5, 2016 22:48
OAuth user authentication with Node.js, Express, Passport, and Angular.

Proposed improvement to user authentication for the MEAN boilerplate. See linnovate/mean#121

Node/Express/Passport

  1. An express route for /auth/<service_provider> uses passport to redirect to the oauth service provider
  2. The OAuth provider redirects back to /auth/<service_provider>/callback
  3. Finally, Express redirects to /. Once authenticated, user data is available as JSON from /users/me.

Angular

  1. There is a main controller set on the body element, MainCtrl.
  2. It calls the login method on a service, AuthService. AuthService.login() attempts to make an Angular $http request to /users/me.
@FireZenk
FireZenk / demo_data_layer.java
Last active October 13, 2016 22:11
Demo snippets from the "Clean Architecture: As we have applied in Mr.Milú" slides
public class Mediator {
public Observable<Auth> login(Login loginModel) {
if (loginStrategy.isAlreadyLogged())
return Observable.from(authCache);
else
return repository.login(loginMapper.toRequest(loginModel))
.map(entity -> authMapper.fromResponse(entity));
}
}
@Frikish
Frikish / SwipeRefreshLayout and StickyListHeaders.md
Last active February 23, 2017 08:57
SwipeRefreshLayout with StickyListHeaders

Trying to find a solution

I had a problem getting the new fancy SwipeRefreshLayout from the appcompat lib to work with a custom listview, in this case the StickyListHeaders. Since the First child of the SwipeRefreshLayout should be either a ScrollView or a pure List, some workaround had to be done.

@mattdesl
mattdesl / ShaderLesson3LibGDX.java
Created December 11, 2012 01:23
ShaderLesson3 Ported to LibGDX
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
@android10
android10 / AndroidApplication.java
Created July 20, 2016 09:56
Android: how to know if your app is completely hidden
public class AndroidApplication extends MultiDexApplication {
public static final String TAG = AndroidApplication.class.getSimpleName();
@Override
public void onCreate() {
super.onCreate();
registerComponentCallbacks(new ComponentCallback());
}
private class ComponentCallback implements ComponentCallbacks2 {
@alorma
alorma / CalendarDsl.kt
Last active February 8, 2018 16:33
Kotlin calendar DSL
import java.util.*
@DslMarker
annotation class CalendarDsl
@CalendarDsl
class CalendarBuilder(val calendar: Calendar) {
fun dayOfMonth(function: () -> Int) = calendar.apply { set(Calendar.DAY_OF_MONTH, function()) }
fun dayOfMonth(value: Int) = calendar.apply { set(Calendar.DAY_OF_MONTH, value) }
import android.media.MediaRecorder;
import android.support.annotation.NonNull;
import com.f2prateek.rx.android.schedulers.AndroidSchedulers;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import rx.Observable;
import rx.subscriptions.Subscriptions;
public class RxMediaRecorder {