public static Integer find(List<String> list, String name, int i) {
    if(list.get(i).equals(name)) {
        return i;
    }
    else return find(list, name, i+1)
}
By s0m31, 2022-06-03 15:54:11
let length str =
    let len = String.length str in
    
    let rec length_helper str curr = 
    if str = "" then 0 else 1 + length_helper (String.sub str 1 (len - curr - 1)) (curr + 1)
    
    in length_helper str 0;;

We use this code internally at Google. JFC.

By Mark, 2018-04-21 21:51:57
div.body:first-child:nth-last-child(n+12),
div.body:first-child:nth-last-child(n+12) ~ div.body {
  padding: 3px 5px 2px !important;

  div.rect {
    top: 6px !important;
  }

  div.legend-action {
    top: 3px !important;
  }
}
By Anonymous, 2018-06-04 10:46:38
<style type="text/css">
    <?php echo file_get_contents(
            \realpath(ROOT_PATH . '/public/').$this->assetPath('css/styles.css', true)
            ); ?>
</style>

Including style file (about 100kb) directly to HTML page. Thanks for developer, it's in .

By Ed, 2023-07-28 10:51:07
// this.collectPairs() returns data from the UI form 
// this.alert.alarmReasons contains empty array or alarmReason-Category pair objects

let newAlarmReasonsToAdd = []

this.collectPairs().forEach(categoryAndAlarmReasonPair => {
  !!!this.searchAmidExisting(categoryAndAlarmReasonPair, this.alert.alarmReasons) ? newAlarmReasonsToAdd.push(categoryAndAlarmReasonPair) : null
})

searchAmidExisting(alarmReasonToAdd, existingAlarmReasons){
    let res = existingAlarmReasons.find(existing => {
    if(alarmReasonToAdd.categoryDictEntryKey === existing.category && alarmReasonToAdd.reasonDictEntryKey === existing.reason){
      return true
    } else return false
  })
    return res
  }
By mallioppilas, 2023-11-03 14:13:41
#define omae
#define wa (void)0
#define mou (void)0
#define shinderu ;
#define nani (void)
#define return 0; return

int main(void) {
    omae wa, mou shinderu
    nani!
    return 0;
}
By Nobody cares, 2020-05-19 06:46:01
private readonly FooType _foo = new FooType();

/// <summary>
/// Gets the controller of this component
/// </summary>
private FooType Foo
{
    get
    {
        return _foo;
    }
}
By Anonymous, 2018-07-25 13:55:26
export const LandingReducer=createSlice({
    name:'MAIN_SLICE',
    initialState:initialStates,
    reducers: {
        changeStateValue:(state,action) => {
            state[action.payload.name] = action.payload.value
            const check = action.payload.name.includes('.')
            if (!check) {
                state[action.payload.name] = action.payload.value
            }else{
                const groups=action.payload.name.split('.')
                console.log(groups);
                if(groups.length===2){
                    state[groups[0]][groups[1]]=action.payload.value;
                }else if(groups.length===3){
                    state[groups[0]][groups[1]][groups[2]]=action.payload.value;
                }else if(groups.length===4){
                    state[groups[0]][groups[1]][groups[2]][groups[3]]=action.payload.value;
                }
            }
        }
    }
});
By shitmaker, 2023-08-08 16:33:56
#112 Go -12
if err != nil {
    return err
}
By the intelligentsia of /r/pcj, 2017-12-12 09:37:38
def get_first_index_of_array(array):
    """
    this function is very usefull for get first index of array
    """
    return array[0]


assert get_first_index_of_array([1, 2, 3, 4, 5]) == 1
assert get_first_index_of_array([1, 2, 3, 4, 5]) != 2
assert get_first_index_of_array([1, 2, 3, 4, 5]) != 3
assert get_first_index_of_array([1, 2, 3, 4, 5]) != 4
assert get_first_index_of_array([1, 2, 3, 4, 5]) != 4
By Mohammad Hosseini, 2017-12-13 15:29:01
	// Check if marked for deletion and run finalizers
	if k8sutil.IsMarkedForDeletion(instance.ObjectMeta) {
		return r.checkFinalizers(ctx, log, instance)
	}
By Anonymous, 2019-12-31 15:25:32
                    //read country intformation and assign to variables
                    cName = InpList.get(0).replace(",", ".");
                    cCode = InpList.get(1).replace(",", ".");
                    cAlpha2 = InpList.get(2).replace(",", ".");
                    cAbreviation = InpList.get(3).replace(",", ".");
                    dYear = InpList.get(4).replace(",", ".");
                    dPoliticalCompatibility = InpList.get(5).replace(",", ".");
                    dRankPoliticalCompatibility = InpList.get(6).replace(",", ".");
                    dEconomicCompatibility = InpList.get(7).replace(",", ".");
                    dRankEconomicCompatibility = InpList.get(8).replace(",", ".");
                    dMilitaryCompatibility = InpList.get(9).replace(",", ".");
                    dRankMilitaryCompatibility = InpList.get(10).replace(",", ".");
                    dDemoScore = InpList.get(11).replace(",", ".");
                    dRankDemoScore = InpList.get(12).replace(",", ".");
                    dEnvironmentalCompatibility = InpList.get(13).replace(",", ".");
                    dRankEnvironmentalCompatibility = InpList.get(14).replace(",", ".");
                    dSumCompatibility = InpList.get(15).replace(",", ".");
                    dRankCompatibility = InpList.get(16).replace(",", ".");
                    dPoliticalUtility = InpList.get(17).replace(",", ".");
                    dRankPoliticalUtility = InpList.get(18).replace(",", ".");
                    dEconomicUtility = InpList.get(19).replace(",", ".");
                    dRankEconomicUtility = InpList.get(20).replace(",", ".");
                    dMilitaryUtility = InpList.get(21).replace(",", ".");
                    dRankMilitaryUtility = InpList.get(22).replace(",", ".");
                    dEnvironmentalUtility = InpList.get(23).replace(",", ".");
                    dRankEnvironmentalUtility = InpList.get(24).replace(",", ".");
                    dSumUtility = InpList.get(25).replace(",", ".");
                    dRankUtility = InpList.get(26).replace(",", ".");
                    dPoliticalScore = InpList.get(27).replace(",", ".");
                    dRankPoliticalScore = InpList.get(28).replace(",", ".");
                    dEconomicScore = InpList.get(29).replace(",", ".");
                    dRankEconomicScore = InpList.get(30).replace(",", ".");
                    dMilitaryScore = InpList.get(31).replace(",", ".");
                    dRankMilitaryScore = InpList.get(32).replace(",", ".");
                    dEnvironmentalScore = InpList.get(33).replace(",", ".");
                    dRankEnvironmentalScore = InpList.get(34).replace(",", ".");
                    dAggregate = InpList.get(35).replace(",", ".");
                    dRankAggregate = InpList.get(36).replace(",", ".");
By Anonymous, 2017-12-17 21:45:26
set_locations(locations){
    return new Promise((resolve, reject) => {
        this.locations = locations;
        resolve();
    });
}
By Anonymous, 2018-04-04 14:44:45
boolean isUserAuthorized = user.isSuperAdmin();
if (!isUserAuthorized) {
    isUserAuthorized = isUserAdminOfEntity1();
}
if (!isUserAuthorized) {
    isUserAuthorized = isUserAdminOfEntity2();
}
if (!isUserAuthorized) {
    throw new AccessDeniedException("Authenticated user is not admin ");
}
By tralaladidou, 2019-05-07 16:37:32
// var array = retrieveArrayValue();
var filteredArray = array.filter(function (element, index, array) {
    return array.indexOf(element) == index;
});
// processArray(filteredArray);
By Anonymous, 2020-08-20 11:24:51