Skip to content

Instantly share code, notes, and snippets.

View abdullahicyc's full-sized avatar

abdullahicyc

View GitHub Profile
@joemasilotti
joemasilotti / Endpoint.swift
Last active May 28, 2023 16:54
A Rails-like environment helper for iOS apps, from https://masilotti.com/rails-like-endpoint-switcher-for-ios-apps/
import Foundation
enum Environment: String {
case development, staging, production
}
extension Environment {
static var current: Environment {
if isAppStore {
return .production
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active May 22, 2024 06:03
Online Resources For Web Developers (No Downloading)
@mahamuniraviraj
mahamuniraviraj / installLatestGitOnCentOs7.txt
Created May 10, 2017 19:56
Install Latest Git On Cent OS 7
# Centos 7.3 comes with 1.8.3
# so update git from centos repo
yum update git
# it shows nothing to update
# we download git source and build and install latest git on Centos 7.3
@arahmanali
arahmanali / mongoose-sum-fields.js
Last active June 19, 2022 10:08
Mongoose sum and group model's field.
/* fetch all users user_totaldocs and user_totalthings values and want to sum those variables.*/
var userSchema = mongoose.Schema({
local : {
...
...
user_id : String,
user_totaldocs : Number,
user_totalthings : Number
....
@kesonno
kesonno / Vagrantfile.rb
Created February 26, 2016 09:50
Ask for user input in Vagrantfile during provisioning phase
if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/#{VM_NAME}/*").empty? || ARGV[1] == '--provision'
print "Please insert your credentials\n"
print "Username: "
username = STDIN.gets.chomp
print "Password: "
password = STDIN.noecho(&:gets).chomp
print "\n"
config.vm.provision :shell, :path => "provision-vagrant.sh", :args => [username, password]
end
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Build;
import android.text.Editable;
import android.util.AttributeSet;
import android.util.TypedValue;
@vasanthk
vasanthk / System Design.md
Last active May 28, 2024 20:01
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@ftvs
ftvs / PhonecallReceiver.java
Last active October 11, 2023 10:05
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: Gabe Sechan http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 28, 2024 08:25
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@alphamu
alphamu / AA Transition App theme between light and dark themes
Last active September 9, 2022 21:59
Example of how to change themes at runtime with a smooth animation. In this example, we just switch between a light and a dark theme. The activity animation is defined in the theme and as such will be default on all activities with the set theme. [Demo Video here](http://youtu.be/Ps0phswbHls).
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
public class TransitionThemeActivity extends AppCompatActivity implements View.OnClickListener {