Skip to content

Instantly share code, notes, and snippets.

View willf80's full-sized avatar
🏠
Working from home

WILLY FALONE KOUADIO willf80

🏠
Working from home
View GitHub Profile
@kn9ts
kn9ts / uuid.js
Created April 10, 2016 16:26
a light UUID generator (written in JS)
export default class UUID {
constructor() {
var d = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
}
@vxhviet
vxhviet / newActivityFromSearchView.md
Last active March 19, 2021 10:21
Start new activity from SearchView

Source: StackOverflow

This answer is a little late but I feel it'll be useful for future viewers. The dilemma seems to come from the ambiguity of the Android SearchView tutorial. The scenario they cover assumes you will be displaying the results in the same Activity the SearchView resides. In such a scenario, the Activity tag in the AndroidManifest.xml file would look something like this:

<activity
    android:name=".MainActivity"
    android:label="@string/main_activity_label"
    android:launchMode="singleTop">
        <intent-filter>
@victorkifer
victorkifer / USSDNetworkService.java
Created January 25, 2014 13:19
USSDNetworkService used to replace Android default one and get USSD messages results.
package com.username.ussd;
import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.IBinder;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.util.Log;
@i-e-b
i-e-b / FileLockInfo.cs
Last active June 7, 2023 10:15
Discover Win32 processes locking a file, and file locks by process. This is quite old now, and better methods are available. Additional research by Walkman100 at https://github.com/Walkman100/FileLocks (see comments section)
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Text;
using System.Threading;
namespace FileLockInfo
{
public class Win32Processes
@j4mie
j4mie / 400or403.md
Created November 20, 2011 20:02
400 or 403?

400 or 403 for invalid form submission?

Conclusion: use 400

The Spec ( http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html )

10.4.1 400 Bad Request

The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.