Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Gomez danielgomezrico

View GitHub Profile
@rock3r
rock3r / giffify.py
Last active Mar 8, 2021
Giffify - easily create optimised GIFs from a video
View giffify.py
#!/usr/bin/python
# License for any modification to the original (linked below):
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Sebastiano Poggi and Daniele Conti wrote this file. As long as you retain
# this notice you can do whatever you want with this stuff. If we meet some day,
# and you think this stuff is worth it, you can buy us a beer in return.
import argparse, sys, subprocess, tempfile
@mbalex99
mbalex99 / gist:8802db1695f20c520ca0
Last active Jan 29, 2020
Alamofire and RxSwift
View gist:8802db1695f20c520ca0
let rx_request = Observable<Value>.create { (observer) -> Disposable in
let requestReference = Alamofire.request(.POST, url, parameters: payload)
.responseJSON(completionHandler: { (response) in
if let value = response.result.value {
observer.onNext(value)
observer.onCompleted()
}else if let error = response.result.error {
observer.onError(error)
}
})
@ashleymills
ashleymills / UIApplication+AppVersion.swift
Last active Feb 29, 2020
UIApplication extension to get app version / build
View UIApplication+AppVersion.swift
extension UIApplication {
class func appVersion() -> String {
return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
}
class func appBuild() -> String {
return Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as! String
}
@yqritc
yqritc / gist:ccca77dc42f2364777e1
Last active May 14, 2021
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration
View gist:ccca77dc42f2364777e1

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@geekmanager
geekmanager / make-git-use-sublime.markdown
Last active Jun 6, 2021
Making git use Sublime Text for rebase etc
View make-git-use-sublime.markdown

Making git use Sublime Text

First up, let's make Sublime Text 2 available from the command line in terminal, by creating a link to subl which is the launcher from terminal:

ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

(added bonus of this approach is when you upgrade to ST3 or change text editor, you can just redirect the symlink).

If there's any chance that bash doesn't check usr/local/bin then use [Launch Sublime Text 2 from Mac OSX Terminal] for more detailed instructions on how to make this happen.

@JoanZapata
JoanZapata / MapsUtils.java
Created Feb 5, 2015
Util for using MapView instead of MapFragment and still avoid boilerplate code to delegate all the activity lifecycle (onCreate, onResume, onPause, onDestroy, etc...) to the MapView.
View MapsUtils.java
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.MapsInitializer;
import static java.lang.String.format;
public class MapsUtils {
View res_color_btn_flat_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/flat_disabled_text"/>
<item android:color="@color/flat_normal_text"/>
</selector>
@lapastillaroja
lapastillaroja / DividerItemDecoration.java
Last active May 30, 2021 — forked from akmalxxx/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
View DividerItemDecoration.java
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
View Android CI
#Android and CI and Gradle (A How-To)
There are tech stacks in this world that make it dead simple to integrate a <abbr title="Continuous Integration">CI</abbr> build system. <br>
The Android platform is not one of them.
Although Gradle is getting better, it's still a bit non-deterministic, and some of the fixes you'll need will start to feel more like black magic than any sort of programming.
But fear not! It can be done!
Before we embark on our journey, you'll need a few things to run locally:
@ZevEisenberg
ZevEisenberg / resetAllSimulators.sh
Last active May 20, 2021
Reset all iOS simulators with this one weird trick
View resetAllSimulators.sh
osascript -e 'tell application "iOS Simulator" to quit'
osascript -e 'tell application "Simulator" to quit'
xcrun simctl erase all