Skip to content

Instantly share code, notes, and snippets.

View indrajitsinh's full-sized avatar

CodeNinja indrajitsinh

View GitHub Profile
@felipekm
felipekm / pm2_rust.md
Last active July 23, 2024 12:09
Use PM2 with RUST

Make a Rust project: cargo init foo

Install PM2:

  1. npm init
  2. npm install pm2

Create a script entry in your package.json to launch pm2:

@thomasdarimont
thomasdarimont / App.java
Last active October 27, 2023 07:44
Secure REST API Example with Spring Security, Spring Session, Spring Boot
package demo;
import java.io.Serializable;
import java.security.Principal;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active June 17, 2024 06:08
The best FRP iOS resources.

Videos

@kristopherjohnson
kristopherjohnson / locking.swift
Last active June 5, 2021 03:04
Simple synchronization functions for Swift, wrapping the Cocoa NSLocking classes
import Foundation
/// Protocol for NSLocking objects that also provide tryLock()
public protocol TryLockable: NSLocking {
func tryLock() -> Bool
}
// These Cocoa classes have tryLock()
extension NSLock: TryLockable {}
extension NSRecursiveLock: TryLockable {}
import Foundation
extension String
{
var length: Int {
get {
return countElements(self)
}
}
@prime31
prime31 / gist:5675017
Last active September 9, 2024 04:24
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@gabrielemariotti
gabrielemariotti / GenericPreferenceFragment.java
Last active January 12, 2024 18:05
Snippet: PreferenceActivity , PreferenceFragment and header... Please refer to this blog post http://gmariotti.blogspot.it/2013/01/preferenceactivity-preferencefragment.html
package it.gmariotti.android.examples.preference;
import android.os.Bundle;
import android.preference.PreferenceFragment;
public class GenericPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {